Sorry for the generic thread title but I am trying to write a script to auto set up a server for a friend of mine, and a few things have me stumped so I figured I would lump them in here.
1. Salting a Password - I understand what salting is, but what I don;t get is how to use the password after salting it. For example:
becomes:
Now maybe my syntax is off here, but let's use the password "password," salt it, and assign it ass password for the current logged in user.
Now if I try to log in with password or sa3tHJ3/KuYvI, it claims the password is wrong. What am I doing wrong here?
2. I want to test for the fastest mirror which is up to date or at most 6 hours behind, and automaticly apply this to my sources.list file. I know how to test for a mirror, and I know how to edit the sources list, but I don't know how to grab the result from netstat and use that in sed. Here is what I have. The empty line is to represent where I am stuck:
1. Salting a Password - I understand what salting is, but what I don;t get is how to use the password after salting it. For example:
Code:
perl -e 'print crypt("password", "salt"),"\n"'
Code:
sa3tHJ3/KuYvI
Code:
rootpw=`perl -e 'print crypt("password", "salt"),"\n"'` echo "$user:$rootpw" | chpasswd
2. I want to test for the fastest mirror which is up to date or at most 6 hours behind, and automaticly apply this to my sources.list file. I know how to test for a mirror, and I know how to edit the sources list, but I don't know how to grab the result from netstat and use that in sed. Here is what I have. The empty line is to represent where I am stuck:
Code:
wget http://ftp.de.debian.org/debian/pool/main/n/netselect/netselect_0.3.ds1-14+squeeze1_amd64.deb && sudo dpkg -i netselect*.deb sudo netselect -v -s10 -t20 `wget -q -O- https://launchpad.net/ubuntu/+archivemirrors | grep -P -B8 "statusUP|statusSIX" | grep -o -P "(f|ht)tp.*\"" | tr '"\n' ' '` sed -i 's|old/with/slashes|new/with/slashes|g'
Comment