Linux笔记:Centos7安装后的一些配置

启动ssh服务并设置为开机自启

修改etc/ssh/sshd_config文件

  • port 22的注释符#删掉
  • 添加一行permitRootLogin yes
  • PasswordAuthentication yes的注释符删掉

重新启动ssh服务
systemtcl restart sshd.service
设置开机自动启动ssh服务
systemctl enable sshd.service

执行sudo命令时提示用户不在 sudoers 文件中。此事将被报告的解决办法

[pr1s0n@localhost ~]$ su
密码:
[root@localhost pr1s0n]# chmod 640 /etc/sudoers
[root@localhost pr1s0n]# vim /etc/sudoers
[root@localhost pr1s0n]# chmod 440 /etc/sudoers
[root@localhost pr1s0n]# exit

主要在sudoers文件中添加一个用户,即第三行

## Allow root to run any commands anywhere 
root    ALL=(ALL)       ALL
pr1s0n  ALL=(ALL)       ALL
## Allows members of the 'sys' group to run networking, software, 
## service management apps and more.
# %sys ALL = NETWORKING, SOFTWARE, SERVICES, STORAGE, DELEGATING, PROCESSES, LOCATE, DRIVERS
posted @ 2020-11-02 21:26  pr1s0n  阅读(71)  评论(0编辑  收藏  举报