$ sudo -iu cyrus
sudo: unable to change directory to /srv/cyrus: Permission denied
sudo: unable to execute /bin/zsh: Permission denied
我不明白为什么我会被拒绝/bin/zsh
:
$ stat /bin/zsh
File: `/bin/zsh' -> `/etc/alternatives/zsh'
Size: 21 Blocks: 0 IO Block: 4096 symbolic link
Device: ceh/206d Inode: 49686869 Links: 1
Access: (0777/lrwxrwxrwx) Uid: ( 0/ root) Gid: ( 0/ root)
Access: 2014-05-02 22:19:33.464671249 +0800
Modify: 2014-05-02 22:12:21.447725196 +0800
Change: 2014-05-02 22:12:21.452724872 +0800
Birth: -
和/srv/cyrus
:
$ stat /srv/cyrus/
File: `/srv/cyrus/'
Size: 4096 Blocks: 8 IO Block: 4096 directory
Device: ceh/206d Inode: 50467467 Links: 3
Access: (0750/drwxr-x---) Uid: ( 1002/ cyrus) Gid: ( 1002/ cyrus)
Access: 2014-05-02 22:05:57.702641011 +0800
Modify: 2014-05-02 22:05:58.135612918 +0800
Change: 2014-05-02 22:11:39.313461373 +0800
Birth: -
我该如何调试此类问题?
答案1
我该如何调试此类问题?
没有环境的情况下试试
sudo -s -u cyrus
您还可以跟踪系统调用。
在 Linux 上:
strace sudo -iu cyrus
请注意,某些 Linux 发行版要求您的帐户位于特定组中。