Ubuntu 开机自动登录(命令行模式)

标题Ubuntu 开机自动登录(命令行模式)

GUI的自动登录,直接在Setting>User accounts里面enable就行了,本文介绍的是如何自动登录命令行模式

方法实现

  • 进入vim /etc/init/ 下找到你需要的tty
fire@fire-test:/dev/pts$ vim /etc/init/tty 
tty1.conf  tty2.conf  tty3.conf  tty4.conf  tty5.conf  tty6.conf
  • 修改ttyX.conf中的文件
 tty1 - getty
#
# This service maintains a getty on tty1 from the point the system is
# started until it is shut down again.

start on stopped rc RUNLEVEL=[2345] and (
            not-container or
            container CONTAINER=lxc or
            container CONTAINER=lxc-libvirt)

stop on runlevel [!2345]

respawn
exec /sbin/getty -8 38400 tty1
  • 修改其中的exec /sbin/getty -8 38400 tty1,改为自动登录exec /sbin/getty --autologin username tty1
exec /sbin/getty --autologin username tty1

过程中需要用到的一些命令

如何查看自己的ttyX?

可以使用who命令,查看,如:

fire@fire-test:/dev/pts$ who
fire     tty7         2019-06-10 09:23 (:0)
如何确认getty的命令

可以使用getty --help或者man getty

fire@fire-test:/dev/pts$ getty -h

Usage:
 getty [options] <line> [<baud_rate>,...] [<termtype>]
 getty [options] <baud_rate>,... <line> [<termtype>]

Open a terminal and set its mode.

Options:
 -8, --8bits                assume 8-bit tty
 -a, --autologin <user>     login the specified user automaticall

  • 1
    点赞
  • 7
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值