Ubuntu 使用 Root 账号登录,并配置网络连接

Kevin 教程 5,832 次浏览 80条评论

启用 Root 账号

运行sudo su切换到 root 登录(需验证当前用户密码),passwd root设置密码即完成启用。

若要停用 root 则运行sudo passwd -l root(用具有 sudo 权限的用户登录运行)。

若要删除之前创建的用户使用userdel -r 用户名命令(这将同时删除用户目录和文件)。

允许 root 以密码方式登录 SSH

确保有安装openssh server软件包(没有用下面命令安装),不然将无法使用 SSH。

apt-get install openssh-server

修改/etc/ssh/sshd_config配置文件,更改以下两个参数。

PermitRootLogin yes             # 允许 root 密码登录
PermitEmptyPasswords no         # 禁止空密码登录

重启 SSH 服务生效。

systemctl restart ssh

配置网络连接

下面方法适用于 Ubuntu 16.04。如果是 Ubuntu 18.04 可参考网上这篇文章

先运行ifconfig -a查看网卡名称,下图红框部分。

Ubuntu ifconfig

编辑/etc/network/interfaces网卡配置文件,添加以下内容设置 IP、网关和子网掩码。

下面是一个示例,其中 ens3 用之前查询到的网卡名称替换。

auto ens3
iface ens3 inet static
        address xxx.xxx.xxx.xxx
        gateway xxx.xxx.xxx.xxx
        netmask xxx.xxx.xxx.xxx
        dns-nameservers 8.8.8.8 8.8.4.4

若要设置 DHCP 自动获取 IP ,则相应设置为如下。

auto ens3
iface ens3 inet dhcp

刷新 IP 和重启网络生效。

ip addr flush ens3
systemctl restart networking

之后 ping 个域名测试是否正常。如果有问题,用ip a showip r命令检查 IP 和路由。

补充:如果要将网卡设备名称改为传统的eth0,修改/etc/default/grub文件,将里面的 GRUB_CMDLINE_LINUX 参数改为如下这样。

GRUB_CMDLINE_LINUX="net.ifnames=0 biosdevname=0"

之后运行update-grub更新文件,重启系统生效。

上面方法同样适用于 Debian 系统。补充个 Debian 问题,如果安装系统后访问 HTTPS 资源提示证书问题,需要安装下面软件包。

apt-get install ca-certificates

评论列表

  1. #1

    Hi, very nice website, cheers!
    ——————————————————
    Need cheap and reliable hosting? Our shared plans start at $10 for an year and VPS plans for $6/Mo.
    ——————————————————
    Check here: https://www.reliable-webhosting.com/

  2. #2

    hydroxychloroquine by state https://hydroxychloroquine.webbfenix.com/

  3. #3

    what parasites does ivermectin kill in humans https://ivermectin.webbfenix.com/

  4. #4

    hydroxychloroquine buy uk https://hydroxychloroquine.mlsmalta.com/

  5. #5

    cost for viagra http://droga5.net/

  6. #6

    vidalista 5 mg stprxl https://vidalista.mlsmalta.com/

  7. #7

    suhagra tablet https://suhagra.buszcentrum.com/

  8. #8

    ivermectin human use https://ivermectin.mlsmalta.com/

  9. #9

    priligy side effects headache https://ddapoxetine.com/

  10. #10

    vidalista drug interactions list https://vidalista40mg.mlsmalta.com/

  11. #11

    cialis tablets 5mg price https://wisig.org/

  12. #12

    amstyles.com https://amstyles.com/

  13. #13

    how can i get viagra pills

  14. #14

    family life insurance

  15. #15

    life insurance for over 50

  16. #16

    auto liability

  17. #17

    icici term insurance

  18. #18

    30 day free trial cialis https://tadalafili.com/

  19. #19

    sildenafil soft tabs

  20. #20

    hazard insurance

  21. #21

    home emergency insurance

  22. #22

    cost of levitra in canada

  23. #23

    cost of levitra

  24. #24

    aviva home insurance

  25. #25

    payday calendar

  26. #26

    hydroxychloroquine manufacturers usa https://hydroxychloroquinee.com/

  27. #27

    home owner insurance

  28. #28

    house insurance comparison

  29. #29

    generic tadalafil 20 mg canada

  30. #30

    quick money online free

  31. #31

    female viagra tablet in india

  32. #32

    tadalafil generic sales in canada https://tadalafil.cleckleyfloors.com/

  33. #33

    coles home insurance

  34. #34

    how is hydroxychloroquine manufactured https://hydroxychloroquine.wisig.org/

  35. #35

    how is hydroxychloroquine manufactured https://hydroxychloroquine.mymvrc.org/

  36. #36

    homeowner’s insurance

  37. #37

    generic viagra 50

  38. #38

    best personal loan

  39. #39

    does acyclovir works for women https://www.herpessymptomsinmen.org/productacyclovir/

  40. #40

    biggest risk of taking tamoxifen https://tamoxifen.mrdgeography.com/

  41. #41

    how to get prescription online https://buymeds.mlsmalta.com/

  42. #42

    how to get prescription online https://medpills.bee-rich.com/

  43. #43

    viagra in mexico over the counter https://zsildenafil.com/

  44. #44

    best price aurogra 100mg https://aurogra.buszcentrum.com/

  45. #45

    where can you buy tadalafil over the counter https://cialis.mrdgeography.com/

  46. #46

    where can you buy tadalafil over the counter https://cialis.buszcentrum.com/

  47. #47

    cialis generic http://tadalafila.online/

  48. #48

    australian shepherd ivermectin toxicity http://ivermmectin.com/

  49. #49

    online health visit https://edmeds.buszcentrum.com/

  50. #50

    cialis website https://cialzi.com/

  51. #51

    The other day, while I was at work, my sister stole my apple ipad and tested to see if it can survive a
    40 foot drop, just so she can be a youtube sensation. My apple ipad is
    now broken and she has 83 views. I know this is
    totally off topic but I had to share it with someone! http://antiibioticsland.com/Cipro.htm

  52. #52

    Right away I am ready to do my breakfast, when having my breakfast coming over again to read other news. http://cialis.audiovideoninja.com/tadalafil

  53. #53

    lowest price cialis 20mg https://cialis.bee-rich.com/

  54. #54

    lowest price cialis 20mg https://cialis.adicbc.com/

  55. #55

    I have read a few just right stuff here. Certainly value bookmarking for revisiting. I surprise how so much effort you set to create this type of excellent informative website.

    http://www.vreyrolinomit.com/

  56. #56

    It’s actually a cool and useful piece of info.
    I’m glad that you simply shared this useful info with us.
    Please keep us up to date like this. Thank you for sharing. http://hydroxychloroquinea.anafassia.com/

  57. #57

    WONDERFUL Post.thanks for share..extra wait .. …

    http://www.vreyrolinomit.com/

  58. #58

    Greetings! I know this is kinda off topic however I’d
    figured I’d ask. Would you be interested in exchanging links or maybe guest authoring a blog
    post or vice-versa? My website goes over a lot of the same topics as yours
    and I feel we could greatly benefit from each other.

    If you’re interested feel free to shoot me an e-mail.

    I look forward to hearing from you! Great blog by the way! http://herreramedical.org/chloroquine

  59. #59

    Hey There. I found your blog the usage of msn. This is a very
    smartly written article. I’ll make sure to bookmark
    it and come back to learn more of your useful information. Thanks for the
    post. I will certainly comeback. http://www.deinformedvoters.org/sildenafil-price

  60. #60

    buy cialis without prescriptions http://edbuy.online/

  61. #61

    buy cialis without prescriptions http://edonline.online/

  62. #62

    What’s up mates, its enormous paragraph on the topic of educationand entirely defined, keep it up all
    the time. http://antiibioticsland.com/Tetracycline.htm

  63. #63

    hydroxychloroquine sulfate uses https://hhydroxychloroquine.com/

  64. #64

    Hi, I think your blog might be having browser compatibility issues. When I look at your blog site in Opera, it looks fine but when opening in Internet Explorer, it has some overlapping. I just wanted to give you a quick heads up! Other then that, amazing blog!

    http://www.zortilonrel.com/

  65. #65

    buy hydroxychloroquine online https://hydroxychloroquinex.com/

  66. #66

    vidalista dosage forum http://vidallista.com/

  67. #67

    It’s very trouble-free to find out any matter on net as compared to books, as I found
    this piece of writing at this website. https://hydroxychloroquineg.grassfed.us/

  68. #68

    I have been reading out many of your posts and i can claim pretty clever stuff. I will definitely bookmark your site.

    http://www.vreyrolinomit.com/

  69. #69

    brand vidalista online pharmacy http://viidalista.co/

  70. #70

    This is a topic that’s near to my heart… Thank you!
    Exactly where are your contact details though? https://cialis.confrancisyalgomas.com/tadalafil

  71. #71

    tadalafil 10mg online tadalafil 40 mg for sale cialis rx http://www.tadalafill.online/

  72. #72

    Tadalafil duration boxtadafil.com what does cialis
    tadalafil do

  73. #73

    Have you ever heard of second life (sl for short). It is basically a game where you can do anything you want. Second life is literally my second life (pun intended lol). If you want to see more you can see these sl articles and blogs

    wiki.jokaydia.com/index.php?title=Enetworks07_eventdocumentation&diff=cur&oldid=721&printable=yes&printable=yes

  74. #74

    Have you ever heard of second life (sl for short). It is essentially a online game where you can do anything you want. Second life is literally my second life (pun intended lol). If you would like to see more you can see these second life articles and blogs

    wiki.jokaydia.com/index.php?title=Enetworks07_eventdocumentation&diff=prev&oldid=723

  75. #75

    What’s up, I read your blog on a regular basis.
    Your story-telling style is awesome, keep doing what you’re doing! http://www.deinformedvoters.org/viagra-generic

  76. #76

    can you buy prednisone over the counter https://bvsinfotech.com/

  77. #77

    Tenormin cialis professional pharmacy
    discount

  78. #78

    Canada prescription plus pharmacy Rumalaya prescription drug price comparison

  79. #79

    Tadafil cialis http://cileve.com/ cialis
    capsules canada

  80. #80

    Buy cialis 20 mg order cialis in australia purchase cialis
    with paypal

发表评论

电邮地址用于 Gravatar 头像显示,不会被公开可见。