linux删除某用户密码

1、清空一个linux用户密码

# passwd -d user1
passwd: password expiry information changed.

  

2、指定key登录

ssh port111@10.0.1.24 -p1024 -i /root/.ssh/id_rsa_port111

  

3、测试ssh远程sudo到某用户上执行命令

[root@localhost ~]# ssh port211@185.139.xxx.xxx -p xx0x4 "sudo -u user_1 lsof -i:33001"
port111@185.139.xxx.xxx's password: 
COMMAND  PID    USER   FD   TYPE DEVICE SIZE/OFF NODE NAME
sshd    2684 portmap    7u  IPv4  13786      0t0  TCP *:33001 (LISTEN)
sshd    2684 portmap    8u  IPv6  13787      0t0  TCP *:33001 (LISTEN)
[root@localhost ~]# 

  

 

4、linux sudo报错:sudo: sorry, you must have a tty to run sudo

使用不同账户,执行执行脚本时候sudo经常会碰到

sudo: sorry, you must have a tty to run sudo这个情况,其实修改一下sudo的配置就好了

vi /etc/sudoers (最好用visudo命令)

注释掉 Default requiretty 一行

#Default requiretty

意思就是sudo默认需要tty终端。注释掉就可以在后台执行了。

 

posted on 2019-03-01 14:20  nmap  阅读(12759)  评论(0编辑  收藏  举报

导航