Can't log in after changing home directory

Can't log in after changing home directory

我以 root 身份登录控制台并运行以下命令:usermod -d /mirror florencia

该文件mirror夹位于/mirror

答案1

以 root 身份登录并通过运行将其改回以前的状态usermod -d /home/florencia florencia

I don't know what you were trying to do exactly, but you should generally not change your home directory like that.

答案2

PLEASE READ EVERYTHING BEFORE MAKING CHANGES!

here is how you want to move a "/home" directory to another drive or location.

  1. Logout. You have to be in the TTY only.
  2. Open TTY by pressing CTRL+ALT+F1
  3. Login using your name and password

now here is where we start doing things.

cd /
sudo mkdir mnt/
sudo mount /dev/sdXX /mnt

note: replace /dev/sdXX with the specific partition or folder destination. example: /dev/sdc1 or /home/backup

now we are going to copy the contents of things.

sudo rsync -aux /home /mnt

unmount the old partition or location

sudo umount /home

delete the old /home

rm -rf /home

get device UUID for fstab

sudo blkid

open fstab and edit

sudo nano /etc/fstab
UUID=copieduuidnumber    /home    ext4    defaults    0   2

note: if you are using a different filesystem then change ext4 to whatever you are using. example: ext3 or ntfs

reboot and see if things are good

sudo reboot

答案3

If everything is done correctly and you loop on login page without accessing you might just need to copy your .bashrc to your new home dir

相关内容