본문 바로가기

리눅스

[리눅스] 우분투 기본 설정

반응형

우분투 기본 설정

테스트 환경

$ cat /etc/os-release
NAME="Ubuntu"
VERSION="20.04 LTS (Focal Fossa)"
ID=ubuntu
ID_LIKE=debian
PRETTY_NAME="Ubuntu 20.04 LTS"
VERSION_ID="20.04"
HOME_URL="https://www.ubuntu.com/"
SUPPORT_URL="https://help.ubuntu.com/"
BUG_REPORT_URL="https://bugs.launchpad.net/ubuntu/"
PRIVACY_POLICY_URL="https://www.ubuntu.com/legal/terms-and-policies/privacy-policy"
VERSION_CODENAME=focal
UBUNTU_CODENAME=focal

$ getconf LONG_BIT
64

1. 기본 에디터 변경

- 우분투 기본 편집기 : nano

기본 에디터 변경

update-alternatives --config editor

$ sudo update-alternatives --config editor
There are 4 choices for the alternative editor (providing /usr/bin/editor).

  Selection    Path                Priority   Status
------------------------------------------------------------
* 0            /bin/nano            40        auto mode
  1            /bin/ed             -100       manual mode
  2            /bin/nano            40        manual mode
  3            /usr/bin/vim.basic   30        manual mode
  4            /usr/bin/vim.tiny    15        manual mode

Press <enter> to keep the current choice[*], or type selection number: 3
update-alternatives: using /usr/bin/vim.basic to provide /usr/bin/editor (editor) in manual mode

2. CLI 환경에서 네트워크 설정(고정 IP 설정)

ip addr 명령으로 인터페이스 이름 확인

ip addr

$ ip addr
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
...
2: ens33: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP group default qlen 1000
...

00-installer-config.yaml 편집

vim /etc/netplan/00-installer-config.yaml

$ vim /etc/netplan/00-installer-config.yaml
# This is the network config written by 'subiquity'
network:
  ethernets:
    ens33:
      addresses:
      - 192.168.100.10/24
      gateway4: 192.168.100.1
      nameservers:
        addresses:
        - 8.8.8.8

  version: 2

적용(네트워크 재기동)

netplan apply

$ netplan apply

3. sudo 패스워드 없이 사용하기

/etc/sudoers 파일 편집

 user1           ALL=(ALL:ALL) ALL
 user2           ALL=NOPASSWD: ALL

visudo

$ visudo
#
# This file MUST be edited with the 'visudo' command as root.
#
# Please consider adding local content in /etc/sudoers.d/ instead of
# directly modifying this file.
#
# See the man page for details on how to write a sudoers file.
#
Defaults        env_reset
Defaults        mail_badpass
Defaults        secure_path="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/snap/bin"

# Host alias specification

# User alias specification

# Cmnd alias specification

# User privilege specification
root    ALL=(ALL:ALL) ALL

# Members of the admin group may gain root privileges
%admin ALL=(ALL) ALL

# Allow members of group sudo to execute any command
%sudo           ALL=(ALL:ALL) ALL
user1           ALL=(ALL:ALL) ALL
user2           ALL=NOPASSWD: ALL

# See sudoers(5) for more information on "#include" directives:

#includedir /etc/sudoers.d

echo 명령으로 파일 편집

echo 'user2 ALL=NOPASSWD: ALL' >> /etc/sudoers

$ echo 'user2 ALL=NOPASSWD: ALL' >> /etc/sudoers

echo 'user1 ALL=(ALL:ALL) ALL' >> /etc/sudoers

$ sudo su -
[sudo] password for user1:
root@linux:~#

echo 'user2 ALL=NOPASSWD: ALL' >> /etc/sudoers

$ sudo su -
root@linux:~#
728x90
반응형