修改host名字
hostnamectl set-hostname --static (host名字)
bash
配置hosts文件
vim /etc/hosts
修改/etc/network/interfaces文件,添加网卡,重启network服务
vim /etc/network/interfaces
systemctl restart networking(重启)
systemctl status networking(查看状态)
修改权限:chmod -R 777 (文件名)
修改网络配置文件,对应一个网卡
vi /etc/sysconfig/network-scripts/ifcfg-ens33
BOOTPROTO可修改为static(静态获取)和dhcp(动态获取)
ONBOOT要修改成yes
使用ifconfig 和 ip addr 查看ip
在CRT上连接失败,提示 The remote system refused the connection.说明没有开启ssh服务。我的debian上也没有ssh,安装好后还是连接不上,没有开启。看了这个博主Debian安装ssh_debian ssh-CSDN博客,修改文件添加内容就好了。
1.debian安装ssh
apt-get install openssh-server
2.编辑/etc/ssh/sshd_config文件
vim /etc/ssh/sshd_config
添加以下内容
PermitRootLogin yes
3.重启ssh服务
/etc/init.d/ssh restart
4.查看ssh服务状态
/etc/init.d/ssh status
制作欢迎界面
vim welcome.sh
#!/bin/bash
printf "*********************************\n"
printf "%-5s ChinaSkills 2023–CSK\n" (%-5s是缩进)
printf "%-8sModule C Linux\n\n\n"
printf "%-11s>>"`hostname`"<<\n" (这里面不是单引号是键盘1旁边的英文 ` 符号)
echo ">>"`cat /etc/centos-release`"<<"
echo ">> "`date`" <<"
printf "*********************************\n"要注意 welcome.sh的路径
修改vim /root/.bash_profile,在最后添加 bash /welcome.sh,然后vim /etc/issue,清空里面的内容。
修改vim /etc/ssh/sshd_config,将 #PrintLastLog yes 改成 PrintLastLog no 。
然后重启 systemctl restart sshd,reboot。