LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Server (https://www.linuxquestions.org/questions/linux-server-73/)
-   -   error while change password in ubuntu automatically (https://www.linuxquestions.org/questions/linux-server-73/error-while-change-password-in-ubuntu-automatically-901343/)

jsaravana87 09-06-2011 12:46 AM

error while change password in ubuntu automatically
 
Hi
i made a shell scripts in centos for auto password generation as below

sudo useradd -d /opt $3

passwd: unrecognized option '--stdin'

chmod -R 777 /opt

setfacl -m u:$3:rwx /opt

/etc/init.d/vsftpd restart

echo -e " Access\nftp url= ftp://$ip\nusername=$3\npassword=$passftp\ncustomername=$1" | mail -s 'Automated server scripts' xx@gmail.com


When i execute a same scripts in ubuntu lucid 10.04 version im facing error

passftp=$(</dev/urandom tr -dc A-Za-z0-9 | head -c6) ; echo $passftp upto these line its exe fine im facing error in echo $passftp | passwd --stdin $3

root@wipro-desktop:~# passftp=$(</dev/urandom tr -dc A-Za-z0-9 | head -c6) ; echo $passftp ; echo $passftp | passwd --stdin wipro
NsrW9L
passwd: unrecognized option '--stdin'
Usage: passwd [options] [LOGIN]


Regards
arun

Snark1994 09-06-2011 06:35 AM

According to an Ubuntu forum thread, this should work:

Code:

useradd username -p `mkpasswd newpassword`
to set "username"'s password to "newpassword"; so you would use this instead of your "echo $passftp | passwd --stdin wipro". Not tested, as I have neither Ubuntu nor mkpasswd :)


All times are GMT -5. The time now is 08:57 PM.