linux部分基本设置(centos7)

SSH端口号修改

  修改 /etc/ssh/sshd_config 文件

  vi /etc/ssh/sshd_config 

  指定端口为 1000

  直接在文件中加入 Port 1000

  制定 22 和 1000 同时为ssh端口

  Port 22

  Port 100

  保存退出,使设置生效

  service sshd restart  

常用工具未安装

  -bash: ifconfig: command not found

    yum install net-tools;  # 即可完成安装

    yum provides ifconfig  #查看是哪个包提供了ifconfig命令  

Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
 * base: mirrors.aliyun.com
 * extras: mirrors.aliyun.com
 * updates: mirrors.163.com
net-tools-2.0-0.24.20131004git.el7.x86_64 : Basic networking tools
Repo        : @base
Matched from:
Filename    : /usr/sbin/ifconfig

  上面显示 net-tools-2.0-0.24版本

  安装时不需要后缀,直接输入 yum install net-tools 回车即可完成安装

  -bash: wget: command not found

    yum -y install wget

  -bash: vim: command not found

    yum -y install vim*

时间格式

ll 命令用来显示当前所在文件信息 但是时间格式不太习惯,可以通过修改 用户目录下的  .bash_profile 文件修改日期显示格式

.bash_profile 是隐藏文件  需要 ll -a 才能显示

vim .bash_profile 

按i 进入编辑模式 

末尾添加一行 

export TIME_STYLE='+%Y-%m-%d %H:%M:%S' #设置时间显示格式

shift + q 到Ex模式 'wq' 回车保存退出                              w:write 写入   q:quit 退出

source /用户/.bash_profile 即可生效

 

修改终端字体颜色样式

字体显示样式设置文件: /etc/DIR_COLORS

vim /etc/DIR_COLORS

找到 ‘RESET’   

'i'  进入编辑模式

RESET 00;32 # reset to "normal" color    默认  绿色  00 表示普通
FILE 00;32                文件  绿色
DIR 01;34;100 # directory        文件夹 加粗,蓝色,背景灰色   01加粗  34 蓝色  100 背景色 灰色
LINK 01;36               链接文件   加粗   淡蓝色

shift + q 进入Ex模式 , wq  保存退出   source /etc/DIR_COLORS 重新加载配置文件

断开远程服务器重连,输入ll  即可看到效果(不断开,终端不会刷新上面修改的配置)

创建时间 2019-0105

修改时间 2020-0115

 

修改 root 账号名  centos系统

平时用“root”作为root账号登录,可以修改账号名减少别人root密码碰撞攻击

vim /etc/passwd 文件,将root 改成  username007

vim /etc/shadow  将root 改为username007

之后就可以用 username007 作为账号登录linux, 就是root用户

root账号修改账号名的问题:

因为一些默认配置问题在修改root账号名之后,如果重启系统可能会出现基础配置意外问题,比如 systemctl 报错,异常; systemd1 error; 可以尝试将root账号的账号名 “username007” 改回 “root” ,再重启电脑reboot 解决问题。 

posted @ 2020-01-15 11:07  楠予  阅读(190)  评论(0编辑  收藏  举报