[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: setting password via script



On Tue, 2010-08-10 at 01:52 +0000, T o n g wrote:
> Hi,
> 
> What's the easiest way to set password for user account via script? 
> The most common tool would be fine, even if it means that the password 
> has to be clear text.
> 
> Thanks
> 
> -- 
> Tong (remove underscore(s) to reply)
>   http://xpt.sourceforge.net/techdocs/
>   http://xpt.sourceforge.net/tools/
> 
> 

You can write passwords directly to /etc/shadow as root, but it's rather
dangerous to do, but I shouldn't be here to warn you and caution you
since you should already know all this, on to the example:

echo "user_password"|openssl passwd -1 -stdin
$id$salt$encrypted_password

root:$1$RsTbBahJ$2NjYxhHostQUasMcczo1T0:14824:0:99999:7:::


Reply to: