我最近将我的主目录移动到另一个磁盘,现在将其安装在上面/home
- 这似乎有效。
然而,令人费解的一件事是我打开的任何终端模拟器(无论程序、alacrtty、rxvt、xterm 等)默认打开目录/
而不是我的主目录/home/daniel
我不知道该怎么做才能解决这个问题,我可以设置--working-directory
,但这似乎是一个创可贴,因为在我进行移动之前,我的终端总是在 $HOME 中打开......
/|▶ echo $HOME
/home/daniel
/|▶ finger daniel
Login: daniel Name: Daniel
Directory: /home/daniel Shell: /bin/zsh
On since Sun Sep 13 12:49 (BST) on :0 from :0 (messages off)
/|▶ whoami
daniel
/|▶ cd ~
~|▶
~|▶ sudo mount | grep home
/dev/sda3 on /home type ext4 (rw,relatime,seclabel)
/|▶ getent passwd $USER
daniel:x:1000:1000:Daniel:/home/daniel:/bin/zsh
/|▶ ls -lZ $HOME
total 68
drwxr-xr-x. 2 daniel daniel unconfined_u:object_r:unlabeled_t:s0 4096 May 25 18:59 Desktop
drwxr-xr-x. 2 daniel daniel unconfined_u:object_r:unlabeled_t:s0 4096 Aug 5 20:36 Documents
drwxr-xr-x. 2 daniel daniel unconfined_u:object_r:unlabeled_t:s0 4096 Sep 5 11:35 Downloads
drwx------. 15 daniel daniel unconfined_u:object_r:unlabeled_t:s0 4096 Sep 13 13:37 Dropbox
drwxr-xr-x. 2 daniel daniel unconfined_u:object_r:unlabeled_t:s0 4096 May 25 18:59 Music
drwxr-xr-x. 2 daniel daniel system_u:object_r:fusefs_t:s0 0 Jan 1 1970 notes
drwxrwxr-x. 4 daniel daniel unconfined_u:object_r:unlabeled_t:s0 4096 Sep 13 14:39 org
-rw-rw-r--. 1 daniel daniel unconfined_u:object_r:unlabeled_t:s0 17311 Sep 13 13:10 out.out
drwxr-xr-x. 3 daniel daniel unconfined_u:object_r:unlabeled_t:s0 4096 Sep 1 17:58 Pictures
drwxr-xr-x. 2 daniel daniel unconfined_u:object_r:unlabeled_t:s0 4096 May 25 18:59 Public
drwxr-xr-x. 2 daniel daniel unconfined_u:object_r:unlabeled_t:s0 4096 May 25 18:59 Templates
drwxrwxr-x. 2 daniel daniel unconfined_u:object_r:unlabeled_t:s0 4096 Aug 29 21:03 tmp
drwxr-xr-x. 2 daniel daniel unconfined_u:object_r:unlabeled_t:s0 4096 Aug 29 18:40 Videos
我正在运行 Fedora Linux 32
任何人的帮助将不胜感激!
答案1
看起来,当您创建新的 /home 目录时,它没有被标记为主目录,因此当您登录时,selinux 会禁止您的会话访问它。登录后,您可以通过 cd 进入它,但它被错误标记了。
以 root 身份运行restorecon
来修复此问题:
# restorecon -r -v /home