delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2003/05/19/06:14:02

Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sources.redhat.com/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sources.redhat.com/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com
Message-ID: <3EC8AE5A.4090907@imag.fr>
Date: Mon, 19 May 2003 12:13:46 +0200
From: sferriol <sylvain DOT ferriol AT imag DOT fr>
User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.2.1) Gecko/20021226 Debian/1.2.1-9
X-Accept-Language: fr-fr
MIME-Version: 1.0
To: cygwin <cygwin AT cygwin DOT com>
Subject: 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/

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019