不小心让sudo不能使用了,求解 已解决

系统安装、升级讨论
版面规则
我们都知道新人的确很菜,也喜欢抱怨,并且带有浓厚的Windows习惯,但既然在这里询问,我们就应该有责任帮助他们解决问题,而不是直接泼冷水、简单的否定或发表对解决问题没有任何帮助的帖子。乐于分享,以人为本,这正是Ubuntu的精神所在。
回复
wangjun403
帖子: 433
注册时间: 2009-07-06 14:26

不小心让sudo不能使用了,求解 已解决

#1

帖子 wangjun403 » 2009-10-05 20:02

安装软件的时候需要加入环境变量(网上看别人的)
sudo vim /etc/bash.bashrc
添加了如下内容
QUOTE:
if [ -d /usr/local/arm/2.95.3 ] ; then
PATH=/usr/local/arm/2.95.3/bin:"${PATH}"
fi

使新的环境变量生效
# source /etc/profile

结果使用大部分命令都会显示如下
wangjun@my-desktop:~$ clear
Command 'clear' is available in '/usr/bin/clear'
The command could not be located because '/usr/bin' is not included in the PATH environment variable.
bash: clear:找不到命令


wangjun@my-desktop:~$ sudo cd test
Command 'sudo' is available in '/usr/bin/sudo'
The command could not be located because '/usr/bin' is not included in the PATH environment variable.
bash: sudo:找不到命令



终端关闭后再打开就会显示
bash: QUOTE::找不到命令
bash: if[ -d /usr/local/arm/2.95.3 ]:then: 没有该文件或目录
bash: /etc/bash.bashrc: line 64: 在未预料的“fi”附近出现语法错误
bash: /etc/bash.bashrc: line 64: `fi'
Command 'lesspipe' is available in '/usr/bin/lesspipe'
The command could not be located because '/usr/bin' is not included in the PATH environment variable.
bash: lesspipe:找不到命令
Command 'dircolors' is available in '/usr/bin/dircolors'
The command could not be located because '/usr/bin' is not included in the PATH environment variable.
bash: dircolors:找不到命令
Command 'uname' is available in '/bin/uname'
The command could not be located because '/bin' is not included in the PATH environment variable.
bash: uname:找不到命令
Command 'uname' is available in '/bin/uname'
The command could not be located because '/bin' is not included in the PATH environment variable.
bash: uname:找不到命令
bash: [: !=: 需要单个参数
bash: [: 过多的参数
bash: [: 过多的参数
bash: [: =: 需要单个参数
bash: [: 过多的参数
bash: [: 过多的参数
bash: [: 过多的参数
bash: [: 过多的参数
bash: [: 过多的参数
bash: [: 过多的参数
bash: [: =: 需要单个参数
bash: [: =: 需要单个参数
bash: [: =: 需要单个参数
bash: [: =: 需要单个参数
bash: [: =: 需要单个参数
bash: [: =: 需要单个参数
bash: [: =: 需要单个参数
bash: [: =: 需要单个参数
bash: [: =: 需要单个参数
bash: [: =: 需要单个参数
bash: [: 过多的参数
bash: [: =: 需要单个参数
Command 'sed' is available in '/bin/sed'
The command could not be located because '/bin' is not included in the PATH environment variable.
bash: sed:找不到命令

由于现在sudo命令无法使用,所以不能修改/ 目录下你的文件内容了,求解决办法





在Ubuntu中,由于用户权限的问题,不能对一些文件进行编辑,也不能对一些文件夹进行写操作。用Ubuntu Tweak可以解决这个问题。步骤如下:
Ubuntu Tweak——个人设定——脚本——把右边“已禁用的脚本”中的“以管理员身份用文本编辑器打开”和“以管理员身份浏览”拖到左边。然后在文件浏览器中右键单击文本文件并选择“脚本——以管理员身份用文本编辑器打开”,就可以修改并保存系统文件了;或者右键单击文件夹选择“脚本——以管理员身份浏览”,就可以对系统文件夹里的文件进行操作了。

然后删除添加的东西就可以了
生命只不过是上帝借你一用的资本!
头像
windwiny
帖子: 2254
注册时间: 2007-03-13 17:26

Re: 不小心让sudo不能使用了,求解

#2

帖子 windwiny » 2009-10-05 20:28

看不懂的就别乱改, 还改/etc 里的,

用 /usr/bin/nano 把文件改回去
回复