fix sshd_config
This commit is contained in:
		| @@ -4,16 +4,19 @@ | ||||
| CMDS="mkdir touch mv rm ls grep cat vim" | ||||
|  | ||||
| USER=$1 | ||||
| CHROOT=$(eval echo ~$USER) | ||||
| CMDS=($CMDS) # convert to array | ||||
|  | ||||
| # Create user if not exist | ||||
| if ! id "$USER" 2&>/dev/null; then | ||||
| 	echo 'INFO: User not found' | ||||
| 	echo 'Creating...' | ||||
| 	useradd -m $USER | ||||
| 	printf "Match User $USER\n 	ChrootDirectory $CHROOT$CHROOT" > /etc/ssh/sshd_config.d/70-$USER.conf | ||||
| 	echo "Password for $USER:" | ||||
| 	passwd $USER | ||||
| fi | ||||
|  | ||||
| CHROOT=$(eval echo ~$USER) | ||||
| printf "Match User $USER\n 	ChrootDirectory $CHROOT$CHROOT" > /etc/ssh/sshd_config.d/70-$USER.conf | ||||
|  | ||||
| # cp in all commands and dependencies  | ||||
| for cmd in "${CMDS[@]}"; do | ||||
| 	for dep in $( ldd $(which $cmd) | grep -v dynamic | cut -d " " -f 3 | sed 's/://' | sort | uniq ); do | ||||
|   | ||||
		Reference in New Issue
	
	Block a user