virtualbox+centos下非root用户访问不了共享目录

1,  root下 usermod -a -G wheel userName, 重启或者注销

2,当前用户下: [kdb@localhost Desktop]$ sudo usermod -aG vboxsf $(whoami) 重启或注销。

3,可以显示。

 

 

 

 

方法一、直接修改/etc/sudoers文件
1. /etc/sudoers内容格式
# 用户myuser允许运行任何命令操作
myuser ALL=(ALL) ALL

# 用户组mygroup允许运行任何命令操作
%mygroup ALL=(ALL) ALL

2. 修改文件
root@centos-system$ vim /etc/sudoers
添加
myuser ALL=(ALL) ALL

方法二、将用户追加到sudo用户组
root@centos-system$ sudo usermod -a -G sudo userName

在 centos上可能会出现
usermod: group 'sudo' does not exist
因为centos默认没有sudo组,可以将你的用户指向wheel用户组, wheel用户组同样有sudo权限
所以在centos上可以使用如下命令添加用户组
root@centos-system$ sudo usermod -a -G wheel userName

操作后注销重新登录
修改后必须重新登录才生效,否则会报错
sunny is not in the sudoers file. This incident will be reported.

————————————————
版权声明:本文为CSDN博主「二流小宝」的原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接及本声明。
原文链接:https://blog.csdn.net/sweettool/article/details/72731464

 

 

 

你可能感兴趣的:(IT管理)