usermod -a -G adm codersong
修改用户组时出现以下错误:
Command 'usermod' is available in '/usr/sbin/usermod'
The command could not be located because '/usr/sbin' is not included in the PATH environment variable.
This is most likely caused by the lack of administrative privileges associated with your user account.
usermod: command not found
解决方法
将/usr/sbin写入环境变量
export PATH=/usr/sbin:$PATH
这条命令运行后,/usr/sbin下的命令就可以尽情使用了
但是直接在命令行写入环境变量,下次电脑重启后,这个环境变量设置户失效,需要重新再运行这条命令再使环境生效,为以绝后患,需要再进行以下设置:
vi ~/.bashrc
在~/.bashrc中写入
export PATH=/usr/sbin:$PATH
source ~/.bashrc
PS:
在Linux中,修改/etc/profile里的内容,相当于系统环境变量,一般我们只需更改自己用户的环境变量配置文件(~/.bashrc)即可,这样可以保证多个用户的独立性