This is the mail archive of the cygwin@cygwin.com mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

script to change home path in /etc/passwd


hello
i see that ssh read /etc/passwd for searching keys and other files.
i've made a little script to change the home path in /etc/passwd
it's not perfect and may be need improvements.

#!/bin/bash

OS=`uname -o`

# in cygwin case
if [ ${OS} == "Cygwin" ]; then

 	/bin/cp -p /etc/passwd /etc/passwd-bak-tmp &&
 	/bin/grep -v ${USERNAME} /etc/passwd-bak-tmp > /etc/passwd &&
 	mkpasswd -l -u ${USERNAME} -p ${HOME} > /etc/passwd-bak-tmp &&
	/bin/sed -e "s/\/${USERNAME}:/:/" /etc/passwd-bak-tmp >> /etc/passwd &&
	/bin/rm -f /etc/passwd-bak-tmp
fi

Sylvain


-- Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple Problem reports: http://cygwin.com/problems.html Documentation: http://cygwin.com/docs.html FAQ: http://cygwin.com/faq/


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]