728x90
반응형
Ubuntu ROOT 접속 방법
우분투는 설치 시 ssh 나 GUI에서 root 로그인 접속이 제한되어 있습니다.
ssh로 리모트 ubuntu 서버에 접속하는 방법과
GUI 로그인 리스트에서 root 계정 활성화 하는 방법에 대해 알아보겠습니다.
ROOT 접속 계정 비빌 번호 설정
sudo passwd root 명령으로 root 비밀번호를 생성합니다.
ubuntu@ubuntu:~$ pwd
/home/ubuntu
ubuntu@ubuntu:~$ whoami
ubuntu
ubuntu@ubuntu:~$ sudo passwd root
[sudo] password for ubuntu:
New password:
Retype new password:
passwd: password updated successfully
ubuntu@ubuntu:~$ su - root
Password:
root@ubuntu:~# whoami
root
root@ubuntu:~#
/home/ubuntu
ubuntu@ubuntu:~$ whoami
ubuntu
ubuntu@ubuntu:~$ sudo passwd root
[sudo] password for ubuntu:
New password:
Retype new password:
passwd: password updated successfully
ubuntu@ubuntu:~$ su - root
Password:
root@ubuntu:~# whoami
root
root@ubuntu:~#
SSH Root 접속 허용 설정 (/etc/ssh/sshd_config)
#PermitRootLogin prohibit-password => PermitRootLogin yes 설정
|
root@ubuntu:~# vi /etc/ssh/sshd_config |
|
# $OpenBSD: sshd_config,v 1.103 2018/04/09 20:41:22 tj Exp $ |
|
|
|
# This is the sshd server system-wide configuration file. See |
|
# sshd_config(5) for more information. |
|
|
|
# This sshd was compiled with PATH=/usr/bin:/bin:/usr/sbin:/sbin |
|
|
|
# The strategy used for options in the default sshd_config shipped with |
|
# OpenSSH is to specify options with their default value where |
|
# possible, but leave them commented. Uncommented options override the |
|
# default value. |
|
|
|
Include /etc/ssh/sshd_config.d/*.conf |
|
|
|
#Port 22 |
|
#AddressFamily any |
|
#ListenAddress 0.0.0.0 |
|
#ListenAddress :: |
|
|
|
#HostKey /etc/ssh/ssh_host_rsa_key |
|
#HostKey /etc/ssh/ssh_host_ecdsa_key |
|
#HostKey /etc/ssh/ssh_host_ed25519_key |
|
|
|
# Ciphers and keying |
|
#RekeyLimit default none |
|
|
|
# Logging |
|
#SyslogFacility AUTH |
|
#LogLevel INFO |
|
|
|
# Authentication: |
|
|
|
#LoginGraceTime 2m |
|
#PermitRootLogin prohibit-password |
|
PermitRootLogin yes |
|
#StrictModes yes |
|
#MaxAuthTries 6 |
|
#MaxSessions 10 |
SSH 서비스 재 시작 후 접속
sudo service ssh restart
일반계정 ssh ROOT 접속
일반계정에서 접속이 가능 한지 확인해보겠습니다.
ubuntu 계정에서 root 로 정상적으로 접속이 되고 있습니다.
ubuntu@ubuntu:~$ ssh root@192.168.58.130
The authenticity of host '192.168.58.130 (192.168.58.130)' can't be established.
ECDSA key fingerprint is SHA256:HXSV8v929Lw15GM4sjnyr8Od6Y/84S1jrajWaC7PFtk.
Are you sure you want to continue connecting (yes/no/[fingerprint])? yes
Warning: Permanently added '192.168.58.130' (ECDSA) to the list of known hosts.
root@192.168.58.130's password:
tiberoPermission denied, please try again.
root@192.168.58.130's password:
Welcome to Ubuntu 20.04.4 LTS (GNU/Linux 5.13.0-37-generic x86_64)
* Documentation: https://help.ubuntu.com
* Management: https://landscape.canonical.com
* Support: https://ubuntu.com/advantage
17 updates can be applied immediately.
To see these additional updates run: apt list --upgradable
Your Hardware Enablement Stack (HWE) is supported until April 2025.
*** System restart required ***
Last login: Sat Mar 26 07:13:22 2022 from 192.168.58.130
root@ubuntu:~# whoami
root
The authenticity of host '192.168.58.130 (192.168.58.130)' can't be established.
ECDSA key fingerprint is SHA256:HXSV8v929Lw15GM4sjnyr8Od6Y/84S1jrajWaC7PFtk.
Are you sure you want to continue connecting (yes/no/[fingerprint])? yes
Warning: Permanently added '192.168.58.130' (ECDSA) to the list of known hosts.
root@192.168.58.130's password:
tiberoPermission denied, please try again.
root@192.168.58.130's password:
Welcome to Ubuntu 20.04.4 LTS (GNU/Linux 5.13.0-37-generic x86_64)
* Documentation: https://help.ubuntu.com
* Management: https://landscape.canonical.com
* Support: https://ubuntu.com/advantage
17 updates can be applied immediately.
To see these additional updates run: apt list --upgradable
Your Hardware Enablement Stack (HWE) is supported until April 2025.
*** System restart required ***
Last login: Sat Mar 26 07:13:22 2022 from 192.168.58.130
root@ubuntu:~# whoami
root
GUI 리스트에서 root 접속 활성화 하기
아래 3개의 파일을 수정 하면 gui 리스트에 root 계정 접속도 가능합니다.
주석 처리 (#) 를 해주세요.
1./etc/gdm3/custom.conf 수정
2./etc/pam.d/gdm-password
3./etc/pam.d/gdm-autologin
|
vi /etc/gdm3/custom.conf |
|
|
|
# Enabling automatic login |
|
AutomaticLoginEnable = true |
|
AutomaticLogin = root |
|
|
|
[security] |
|
AllowRoot=true |
|
|
|
vi /etc/pam.d/gdm-password |
|
#auth required pam_succeed_if.so user != root quiet_success |
|
|
|
vi /etc/pam.d/gdm-autologin |
|
#auth required pam_succeed_if.so user != root quiet_success |
서버 재기동 후 접속
root@ubuntu:~# shutdown -r now
Notlited 클릭수 username root /비번 입력 후 접속을 진행합니다.
이제 root 도 접속이 가능합니다.
728x90
반응형
'IT > 리눅스마스터1급' 카테고리의 다른 글
[ubuntu] lvm 볼륨 사이즈 확장하기. (0) | 2023.08.13 |
---|---|
[Ubuntu 22.04] 시간대 변경 (UTC -> KST) (0) | 2023.08.13 |
우분투, root 권한으로 로그인하는 방법 (0) | 2023.08.13 |
CentOS 에서 X관련 삭제.. (0) | 2023.08.13 |
[리눅스] GUI, CLI 환경으로 변경 방법 (0) | 2023.08.13 |