解决Portable 设备中Continer里无法使用sudo的问题
来源:互联网 发布:结构优化设计 王光远 编辑:程序博客网 时间:2024/06/10 08:23
解决Portable 设备中Continer里无法使用sudo的问题
环境
使用nspawn 部署的Archlinux. Container本身通过移动设备Mount到Host.
出错现象
执行sudo命令,提示:sudo: effective uid is not 0, is /usr/bin/sudo on a file system with. the 'nosuid' option set or an NFS file system without root privileges?
原因
sudo works with a mechanism that is called setuid (Set User ID, or also called suid). If that bit is set on an executable file (like sudo), then the application is executed under the permissions of the user, who is the owner of that file (in case of sudo, the owner is the root user).
That means, sudo is executed as root. So far so good. But, now nothing prevents you from inserting an USB-drive with a shell on it, that has the setuid bit set. You have full root access! That’s why normally USB-drives are mounted with the mount option noexec, to prevent executing binary/scripts on such a device. Another mount option, if you still want to execute files, is the one that is mentioned in the error message in your question: nosuid.
See that excerpt of the mount manual page:
[…]
nosuid Do not allow set-user-identifier or set-group-identifier bits to take effect.
[…]
解决方案
重新mount移动设备, 去掉nosuid参数,使用suid参数.例如 mount -t ext4 -o ro,suid,dev,exec,auto,nouser,async /dev/sdb /mnt
1 0
- 解决Portable 设备中Continer里无法使用sudo的问题
- Mac OS X中virtualenv里python shell无法使用光标键问题的解决
- 解决Linux下无法使用sudo命令问题
- ubuntu新添加用户无法sudo问题的解决
- Ubuntu新添加用户无法sudo问题的解决
- 解决设备应用程序无法申请到内存,导致设备无法正常工作的问题---优化设备虚拟内存使用
- 解决webapp中使用cordova调用本地相册,在ios设备上无法显示图片的问题
- 无法执行sudo的问题
- 解决linux中sudo su失效的问题
- ubuntu 用户名无法使用 sudo 问题
- 解决虚拟机中安装的mac os系统无法识别ios设备的问题
- 解决设备管理器,控制面板中管理工具无法打开的问题
- 解决ios设备中angularjs无法改变页面title的问题
- 解决pdf.js无法再ios设备中打开的问题
- 解决KOL中无法使用内存流的问题
- 解决eclipse中无法直接使用Base64Encoder的问题
- 解决eclipse中无法直接使用Base64Encoder的问题
- 解决SQLPlus中无法使用历史命令的问题
- 自定义按钮图片和文字的位置
- SSH中集成Quartz任务调度
- Android Studio 混淆打包
- ssh框架基础搭建+spring和hibernate基础配置+所需的架包
- jsoup Cookbook——从一个文件加载一个文档
- 解决Portable 设备中Continer里无法使用sudo的问题
- Awake函数和Start函数的区别
- 算法—趣味理解分治算法
- 关于火狐firefox不能启动解决方法
- PHP分页原理
- Maven简单使用(二)
- 事件处理(Handling Events)和委托(Delegate)代码示例(三)【UE4】【C++】
- [shell]输出月份对应的英文
- Jquery Datatable 单行修改保存后,页码不跳动的实现