Webstract
New Pleskian
TITLE:
chrooted FTP users out of sync on migration
PRODUCT, VERSION, OPERATING SYSTEM, ARCHITECTURE:Plesk Onyx Version 17.5
CentOS Linux 7.3.1611
PROBLEM DESCRIPTION:CentOS Linux 7.3.1611
Migrating from Server A to Server B breaks the access to the server over SSH. All our users were set to `bin/bash (chrooted)` prior to migration. After migration, users were still set to this but could not log in via SSH or SFTP.
STEPS TO REPRODUCE:To Reproduce
ACTUAL RESULT:- Set up user with `bin/bash (chrooted)` access
- Migrate server
- Log into user on new server via SSH
- Cannot login
- Change user to `bin/bash` and Apply or OK
- Change user back to `bin/bash (chrooted)` and Apply or OK
- Now use can log in
- See code below
- Note: this code was a temporary workaround for us. I am just sharing as an example.
Code:
#!/bin/bash
#pull chrooted users to scratch file
cat /etc/passwd|grep chroot > /tmp/chrootedusers.txt
#iterate, look for mismatches
while read line; do
THISUID=`echo ${line} | cut -d: -f3`
THISVHOSTDIR=`echo ${line} | cut -d: -f6`
THISLOCALPWFILE="$THISVHOSTDIR/etc/passwd"
OLDUID=`cat $THISLOCALPWFILE|grep -v "0:Root"|cut -d: -f3`
echo "----------------------------------------"
if [ "$THISUID" != "$OLDUID" ]; then
echo "MISMATCH: $THISUID does not equal $OLDUID"
echo $line
echo "VHOST DIR: $THISVHOSTDIR"
echo "PW FILE TO EDIT: $THISLOCALPWFILE"
echo "Changing..."
cat $THISLOCALPWFILE
sed -i.lwbak "s/$OLDUID/$THISUID/" $THISLOCALPWFILE
echo "Changed, original saved as .lwbak"
cat $THISLOCALPWFILE
else
echo "MATCH: $THISUID equals $OLDUID"
echo "No changes."
fi
done < /tmp/chrootedusers.txt
#remove scratch file
rm -fv /tmp/chrootedusers.txt
Error logging in.
EXPECTED RESULT:Successful login.
ANY ADDITIONAL INFORMATION:
YOUR EXPECTATIONS FROM PLESK SERVICE TEAM:Confirm bug