示sudo: cd: command not found
执行sudo cd 时出现
sudo: cd: command not found
原因
shell
shell是一个命令解析器
所谓shell是一个交互式的应用程序。
shell执行外部命令的 时候,是通过fork/exec叉一个子进程,然后执行这个程序。
sudo
sudo 是一种程序,用于提升用户的权限,在linux中输入sudo就是调用sudo这个程序提升权限
sudo的意思是,以别人的权限叉起一个进程,并运行程序。
cd
cd是shell的内部命令。
也就是说,是直接由shell运行的,不叉子进程。
你在当前进程里当然不能提升进程的权限(其实也可以,不过得编程的时候写到代码里,然后再编译,而我们的 shell没有这个功能,否则岂不是太危险了?
解决办法
但是有一些目录我们普通用户是没有权限进入该目录的,比如/root
那么我们该怎么办呢,
一个有限的办法就是为该目录增加当前用户的可执行权限,但是对我们来说这样并不是很安全
那么还有没有解决办法呢,当然有,Linux下没有什么问题是解决不了的,那就是获取root权限或者文件夹所属用户的权限
使用su 命令即可获取用户的权限,但是root权限怎么获取呢,sudo已经不行了
sudo root 要输入密码
解决方法:
输入sudo su 或者sudo -sH 默认缺省为获取root 用户。
示sudo: cd: command not found的更多相关文章
- sudo: cd: command not found
事件起因 今天在aws ubutun上忽然发现的一个问题,执行sudo cd 时出现 sudo: cd: command not found 原因 shell shell是一个命令解析器 所谓shel ...
- Mac 显示sudo: pip: command not found
Mac显示sudo: pip: command not found mac在安装完pip模块后,使用pip命令会提示sudo: pip: command not found moyanzhudeMac ...
- sudo: ulimit: command not found
在这看到的:http://stackoverflow.com/questions/17483723/command-not-found-when-using-sudo-ulimit 修改系统文件打开数 ...
- alias, bg, bind, break, builtin, caller, cd, command,
bash, :, ., [, alias, bg, bind, break, builtin, caller, cd, command, compgen, complete, com ...
- [问题解决]linux sudo xxx:command not found
题外话 软件的安装在linux下主要分为两种.一种是通过包管理器例如ubuntu的apt-get xxx,另一种是自己手动安装.通过包管理器安装的,基本开箱即用,无需配置,但是存在一个问题,有时候无法 ...
- 解决:sudo: pip: command not found
1-问题:Ubuntu下执行sudo pip install package-name 出现 sudo: pip: command not found 的问题. 2-原因:编译sudo的时候加入了–w ...
- sudo: add-apt-repository: command not found
错误来啦:sudo: add-apt-repository:command not found 网上解决办法是直接安装工具包 命令:sudo apt-get install python-s ...
- sudo: java: command not found
背景:搭建了jumpserver,给开发划分了所有权限,但是开发那边账户不能执行java命令 报错:sudo: java: command not found 解决方法: 在用户管理权限配置sudoe ...
- Ubuntu解决sudo: source: command not found错误
Ubuntu Server上执行以下命令,可以看到默认打开的文件数限制为1024个. $ ulimit -n 1024 编辑/etc/profile配置文件,在最后添加一行: ulimit -SHn ...
随机推荐
- Linux常用命令-入门
linux 开源安全性高 linux 和 windows 1.同时登陆多用户 2.安全 3.linux没有盘符的概念 /. / root 根目录 4.linux的文件没有扩展名 ...
- Greedy_algorithm
https://en.wikipedia.org/wiki/Greedy_algorithm
- Byte History
https://en.wikipedia.org/wiki/Byte The term byte was coined by Werner Buchholz in July 1956, during ...
- OpenMP初步(英文)
Beginning OpenMP OpenMP provides a straight-forward interface to write software that can use multipl ...
- ExtJS 刷新或者重载Tree后,默认选中刷新前最后一次选中的节点代码片段
//tree对象 var tree = Main.getPageControler().treePanel; //获取选中的节点 var node = tree.getSelectionModel() ...
- 【转】get a mysterious problem,when i use HttpWebRequest in unity c# script
in script,i use HttpWebRequest to get service from network.but it comes a mysterious problem. the so ...
- MongoDB的find用法
0.查询符合条件数据的总条数 如:db.list名.find({条件}).count(); 1.返回指定的键值:db.list.find({条件},{name:"任意值",age: ...
- TCP connection status
A TCP connection progresses through a series of states during its lifetime. The following diagram il ...
- (letcode)String to Integer (atoi)
Implement atoi to convert a string to an integer. Hint: Carefully consider all possible input cases. ...
- Fiddler-004-配置过滤器之-域名过滤
前文讲述了通过 Fiddler 进行网络抓包的一个小实例,具体敬请参阅博文: 有些细心的小主可能发现了,我们捕获的 HTTP请求 中有一些请求不是我们需要的,而是一些非必要数据,页面如下图所示: