允许新用户访问/使用/认领旧用户的主页

允许新用户访问/使用/认领旧用户的主页

我的用户帐户 user1 遇到了登录循环问题,因此我创建了一个具有完全权限的新管理员 user2。

是否有一种简单的方法可以让新用户 2 使用旧用户 1 的环境?

理想情况下,我会从登录中删除 user1,而 user2 将拥有 user1 的主目录?

我希望这很容易,并且可以解决登录循环问题。User2 现在没有登录循环。

ls -l /home/rb1888/

dr-xr-xr-x 18 rb1888 rb1888     4096 Jul 26 12:33 . 
drwxr-xr-x  6 root   root       4096 Jul 24 16:18 ..   
-rw-------  1 rb1888 rb1888     9112 Jul 26 12:55 .bash_history
-rw-r--r--  1 rb1888 rb1888      220 Jun  9  2015 .bash_logout 
-rw-r--r--  1 rb1888 rb1888     3760 Jun  9  2015 .bashrc  
drwx------ 20 rb1888 rb1888     4096 Jul 25 17:19 .cache
drwx------ 15 rb1888 rb1888     4096 Jul  9  2015 .config  
drwx------  3 root   root       4096 Jun  9  2015 .dbus 
drwxr-xr-x  4 rb1888 rb1888     4096 Jun  9  2015 Desktop  
-rw-r--r--  1 rb1888 rb1888       25 Jun  9  2015 .dmrc   
drwxr-xr-x  2 rb1888 rb1888     4096 Jul 26 12:53 Documents
drwxr-xr-x  2 rb1888 rb1888     4096 Jun  9  2015 Downloads  
drwxrwxrwx  2 root   root       4096 Jun 10  2015 ftpfiles  
drwx------  3 rb1888 rb1888     4096 Jul 25 17:18 .gconf  
drwx------  2 root   root       4096 Jul 25 17:18 .gvfs
-rw-------  1 rb1888 rb1888     1608 Jul 25 17:18 .ICEauthority
drwx------  3 rb1888 rb1888     4096 Jun  9  2015 .local  
drwx------  4 rb1888 rb1888     4096 Jun  9  2015 .Mozilla   
drwxr-xr-x  2 rb1888 rb1888     4096 Jun  9  2015 Music   
drwxr-xr-x  2 rb1888 rb1888     4096 Jun  9  2015 Pictures   
-rw-r--r--  1 rb1888 rb1888      675 Jun  9  2015 .profile    
drwxr-xr-x  2 rb1888 rb1888     4096 Jun  9  2015 Public   
-rw-r--r--  1 rb1888 rb1888        0 Jun  9  2015 .sudo_as_admin_successful   
drwxr-xr-x  2 rb1888 rb1888     4096 Jun  9  2015 Templates    
drwxr-xr-x  2 rb1888 rb1888     4096 Jun  9  2015 Videos
-rw-rw-r--  1 rb1888 rb1888    23675 Jun  9  2015 webmin_1.750_all.deb
-rw-r--r--  1 root   root   26195366 May 12  2015 webmin_1.750_all.deb.1
-rw-------  1 rb1888 rb1888       52 Jul 26 12:59 .Xauthority
-rw-------  1 rb1888 rb1888    25148 Jul 26 12:59 .xsession-errors
-rw-------  1 rb1888 rb1888     2081 Jun  9  2015 .xsession-errors.old

以下是 Ken (用户 2) 和 rb1888 (用户 1) 的 Auth.log 的一些片段。我可以看到,用户 1 不像systemd: pan_unix(systemd-user:session)用户 2 那样有这个文件,并且登录和停留在 GUI 中没有任何问题。

RB1888 AUTOLOGON
Jul 26 15:26:42 content lightdm: pam_unix(lightdm-autologin:session): session opened for user rb1888 by (uid=0)
Jul 26 15:26:42 content systemd-logind[643]: New session c1 of user rb1888.   
Jul 26 15:26:42 content systemd: pam_unix(systemd-user:session): session opened for user rb1888 by (uid=0)   
Jul 26 15:26:45 content gnome-keyring-daemon[1447]: couldn't access control socket: /run/user/1000/keyring/control: No such file or directory    
Jul 26 15:26:45 content gnome-keyring-daemon[1462]: couldn't access control socket: /run/user/1000/keyring/control: No such file or directory   
Jul 26 15:26:45 content gnome-keyring-daemon[1463]: couldn't access control socket: /run/user/1000/keyring/control: No such file or directory 
Jul 26 15:27:11 content lightdm: pam_unix(lightdm-autologin:session): session closed for user rb1888    
LOGOFF (29 seconds)    
KEN LOGIN
Jul 26 15:40:09 content lightdm: pam_unix(lightdm:session): session opened for user ken by (uid=0)    
Jul 26 15:40:09 content systemd-logind[643]: New session c6 of user ken.    
Jul 26 15:40:09 content systemd: pam_unix(systemd-user:session): session opened for user ken by (uid=0)
Jul 26 15:40:11 content gnome-keyring-daemon[3738]: The SSH agent was already initialized 
Jul 26 15:40:11 content gnome-keyring-daemon[3738]: The GPG agent was already initialized 
Jul 26 15:40:11 content gnome-keyring-daemon[3738]: The Secret Service was already initialized  
Jul 26 15:40:11 content gnome-keyring-daemon[3738]: The PKCS#11 component was already initialized   
Jul 26 15:40:12 content polkitd(authority=local): Registered Authentication Agent for unix-session:c6 (system bus name :1.172 [/usr/lib/policykit-1-gnome/polkit-gnome-authentication-agent-1], object path /org/gnome/PolicyKit1/AuthenticationAgent, locale en_US.UTF-8)
----
1 AUG rb1888 /home/rb1888/.xsession-errors (only last bad login as its long file)  
openConnection: connect: No such file or directory  
cannot connect to brltty at :0  
upstart: upstart-event-bridge main process (10640) terminated with status 1 
upstart: upstart-event-bridge main process ended, respawning 
upstart: upstart-event-bridge main process (10655) terminated with status 1 
upstart: upstart-event-bridge main process ended, respawning  
upstart: upstart-event-bridge main process (10660) terminated with status 1   
upstart: upstart-event-bridge main process ended, respawning   
upstart: upstart-event-bridge main process (10667) terminated with status 1  
upstart: upstart-event-bridge main process ended, respawning 
upstart: upstart-event-bridge main process (10674) terminated with status 1
upstart: upstart-event-bridge main process ended, respawning
upstart: upstart-event-bridge main process (10681) terminated with status 1 
upstart: upstart-event-bridge main process ended, respawning
upstart: upstart-event-bridge main process (10685) terminated with status 1
upstart: upstart-event-bridge main process ended, respawnin 
upstart: upstart-event-bridge main process (10693) terminated with status 1 
upstart: upstart-event-bridge main process ended, respawning  
upstart: upstart-event-bridge main process (10700) terminated with status 1
upstart: upstart-event-bridge main process ended, respawning
upstart: upstart-event-bridge main process (10703) terminated with status 1
upstart: upstart-event-bridge main process ended, respawning  
upstart: upstart-event-bridge main process (10707) terminated with status 1
upstart: upstart-event-bridge respawning too fast, stopped 
upstart: gnome-session (Unity) main process (10739) terminated with status 1
upstart: logrotate main process (10618) killed by TERM signal
upstart: upstart-dbus-session-bridge main process (10719) terminated with 
status 1
upstart: indicator-bluetooth main process (10788) killed by TERM signal  
upstart: indicator-power main process (10789) killed by TERM signal   
upstart: indicator-datetime main process (10790) killed by TERM signal    
upstart: indicator-session main process (10800) killed by TERM signal   
upstart: indicator-printers main process (10793) killed by TERM signal  
upstart: indicator-application main process (10819) killed by TERM signal
upstart: Disconnected from notified D-Bus bus

答案1

来自评论...

terminal...(将 kenc 更改为正确的用户名)

ls -al /home/kenc/.*thority

你应该看到类似这样的内容...

-rw------- 1 kenc kenc 314660 Jul 23 19:10 /home/kenc/.ICEauthority
-rw------- 1 kenc kenc     58 Jun 23 13:05 /home/kenc/.Xauthority

但是,如果您发现它是自己的root,并且/或者文件保护是错误的,就像这个例子一样......

-rwxrwxrwx 1 root root 314660 Jul 23 19:10 /home/kenc/.ICEauthority
-rwxrwxrwx 1 root root     58 Jun 23 13:05 /home/kenc/.Xauthority

然后发出这些命令...

sudo chown kenc:kenc /home/kenc/.ICEauthority
sudo chown kenc:kenc /home/kenc/.Xauthority
sudo chmod 600 /home/kenc/.ICEauthority
sudo chmod 600 /home/kenc/.Xauthority

相关内容