script to change home path in /etc/passwd

sferriol sylvain.ferriol@imag.fr
Mon May 19 11:49:00 GMT 2003


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/



More information about the Cygwin mailing list