Answer the question
In order to leave comments, you need to log in
How to assign a password to a user without my participation?
I am writing a script to install the necessary software on the server. And when installing vsftpd, you need to create a user. Now there is this code:
apt-get update
apt-get install -y vsftpd
useradd -m sftpuser -s /usr/sbin/nologin
passwd sftpuser
Answer the question
In order to leave comments, you need to log in
Google is our everything)))))
FTPUSER="sftpuser"
useradd -m $FTPUSER -s /usr/sbin/nologin
echo "$FTPUSER\n$FTPUSER\n" > ~/$FTPUSER
passwd $FTPUSER < ~/$FTPUSER
rm -f ~/$FTPUSER
You can also do this:echo password123 | passwd --stdin username
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question