0%

今天修改/etc/environment文件,重启后发现无法登陆进入了,用vssh登陆出现以下错误:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
-bash: groups: command not found
Command 'ls' is available in '/bin/ls'
The command could not be located because '/bin' is not included in the PATH environment variable.
ls: command not found
Command 'lesspipe' is available in the following places
 * /bin/lesspipe
 * /usr/bin/lesspipe
The command could not be located because '/bin:/usr/bin' is not included in the PATH environment variable.
lesspipe: command not found
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.
dircolors: command not found
Command 'ls' is available in '/bin/ls'
The command could not be located because '/bin' is not included in the PATH environment variable.
ls: command not found

此时一些例如”ls”的外置命令都无法使用,解决办法:

1
2
export PATH=/usr/bin:/bin
sudo vim /etc/environment

然后在里面添加变量:

1
PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games

保存后:

1
source /etc/environment

问题解决!