Forwarded to devs chrooted system users out of sync on migration

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:
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
  1. Set up user with `bin/bash (chrooted)` access
  2. Migrate server
  3. Log into user on new server via SSH
  4. Cannot login
To Fix (manually)
  1. Change user to `bin/bash` and Apply or OK
  2. Change user back to `bin/bash (chrooted)` and Apply or OK
  3. Now use can log in
To Fix (script used to fix on 150+ users)
  1. See code below
  2. 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
ACTUAL RESULT:
Error logging in.​
EXPECTED RESULT:
Successful login.​
ANY ADDITIONAL INFORMATION:
YOUR EXPECTATIONS FROM PLESK SERVICE TEAM:
Confirm bug
 
Hello!
Could you please provide the following information:
1. Source panel and panel version
2. Command output:
grep exclude /usr/local/psa/var/modules/panel-migrator/sessions/<session_number>/debug.log
 
  1. Currently I am on Plesk Onyx Version 17.5.3 Update #7 (but this migration was a few versions earlier)
  2. I don't have that module installed anymore
 
Back
Top