Linunx 設置登陸賬號和端口

新增管理員

useradd xtang // 添加用戶
vi /etc/passwd //xtang 用戶, 502權限修改爲0
passwd xtang // 添加xtang用戶密碼
passwd root -l // 鎖定root賬號
passwd root -u // 解鎖root賬號
who // 查看當前管理員賬號

修改SSH端口

  • 查看SSH服務
rpm -qa|grep ssh  默認都是開啓的
  • 修改配置文件sshd_config
vi /etc/ssh/sshd_config 
找到 #Port 22
22端口修改爲1111
  • 在防火牆上放開端口
iptables -I INPUT -p tcp -m state --state NEW -m tcp --dport 1111 -j ACCEPT 
iptables-save
iptables -nL --line-number  查看1111端口是否已經正常開放

systemctl restart sshd.service重啓sshd服務
netstat -anp |grep ssh 查看當前ssh鏈接到端口 
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章