网站首页技术博客
Linux切换用户
摘要开发过程中经常需要切换用户,比如切换到web的www用户
切换用户使用su命令,例如
su www
但是,在没有设置的情况下,默认www用户是不能登录的,会报下面的错误
[root@iZ2zeeetxecah9u89x7qt0Z kuaipin8]# su www
This account is currently not available.
这时候需要编辑/etc/passwd
开发过程中经常需要切换用户,比如切换到web的www用户
切换用户使用su命令,例如
su www
但是,在没有设置的情况下,默认www用户是不能登录的,会报下面的错误
[root@iZ2zeeetxecah9u89x7qt0Z kuaipin8]# su www
This account is currently not available.
这时候需要编辑/etc/passwd文件
chenjianfei:x:1000:1000::/home/chenjianfei:/bin/bash
zhengtanyu:x:1001:1001::/home/zhengtanyu:/bin/bash
www:x:1002:1002::/home/www:/sbin/nologin
saslauth:x:989:76:Saslauthd user:/run/saslauthd:/sbin/nologin
mysql:x:1003:1003::/home/mysql:/sbin/nologin
修改www用户的/sbin/nologin 为 /bin/bash
修改后
www:x:1002:1002::/home/www:/bin/bash
wq保存退出
这时就可以切换到www用户了
上一篇:使用supervisor启动shadowsocks出现“Exited too quickly”错误
下一篇:docker: Error response from daemon: devicemapper: Error running
相关文章
- Access denied; you need (at least one of) the SUPER privilege(s) for this operatio
- rm: cannot remove `file': Operation not permitted解决方法 chattr命令详解
- easywechat报错:Failed to cache access token
- chrome模拟微信浏览器的user agent
- jQuery打印插件jqprint
- 实现页面图片的延时异步加载
- 微信小程序登录流程
- mysql General error: 1267 Illegal mix of collations错误
- 基于general_log的mysql日志追踪
- 一个微信链接及接收消息的类