修改debian的网络IP地址+无法连接SSH+root用户登陆Linux

清羽发布于:2019-1-22 1167

修改一个debian  linux的网络地址

注意以下步骤:
修改主机的IP
配置文件为:

 vi /etc/network/interfaces
# This file describes the network interfaces available on your system
# and how to activate them. For more information, see interfaces(5).
# The loopback network interface
auto lo
iface lo inet loopback
# The primary network interface
allow-hotplug eth0
iface eth0 inet static
        address 192.168.6.100
        netmask 255.255.255.0
        network 192.168.6.0
        broadcast 192.168.6.255
        gateway 192.168.6.1
        # dns-* options are implemented by the resolvconf package, if installed
        dns-nameservers 202.96.128.86

修改DNS和(RedHat)CentOS是一样的

vi  /etc/resolv.conf
nameserver 202.96.128.86
无法连接ssh

测试有无ssh

ps -e | grep ssh

如无安装,安装openssh

apt install openssh-server

安装ufw

apt install ufw

开放22端口

ufw enable 
ufw allow 22


Debian设置允许root用户以ssh方式登录

debian默认不允许以root用户登录,必须以其他用户登录,然后su命令切换到root用户才可以操作

1.修改/etc/ssh/sshd_config文件

#将以下配置改为:PermitRootLogin yes
#PermitRootLogin prohibit-password

然后重启ssh服务,即可

service sshd restart

2.顺便写一下允许root用户登录系统

2.1修改/etc/gdm3/daemon.conf文件,新增

[security]
AllowRoot = true

2.2修改/etc/pam.d/gdm-password,注释掉以下内容:

#auth required pam_succeed_if.so user != root quiet_success

重启系统即可



http://www.virplus.com/thread-9.htm
转载请注明:2019-1-22 于 VirPlus 发表

推荐阅读
最新回复 (0)

    ( 登录 ) 后,可以发表评论!

    返回