Season 1 아카이브/프로그래밍
                
              우분투 사용자 추가 - Add user to Ubuntu via command line
                문장전달자
                 2018. 6. 14. 17:05
              
              
                    
        728x90
    
    
  커맨드라인에서 사용자를 추가해보자. 터미널을 열고 다음과 같이 사용자이름을 인수로 갖는 adduser 명령을 실행한다.
예를 들어 아래는 fukaerii 라는 사용자 이름을 가진 유저를 생성한다. 패스워드를 제외하고 모든 정보는 선택사항이다.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17  | :~# sudo adduser fukaerii Adding user `fukaerii' ... Adding new group `fukaerii' (1004) ... Adding new user `fukaerii' (1000) with group `fukaerii' ... Creating home directory `/home/fukaerii' ... Copying files from `/etc/skel' ... Enter new UNIX password: Retype new UNIX password: passwd: password updated successfully Changing the user information for fukaerii Enter the new value, or press ENTER for the default         Full Name []:         Room Number []:         Work Phone []:         Home Phone []:         Other []: Is the information correct? [Y/n] Y  | cs | 
1 2 3  | root@server:~# su fukaerii fukaerii@server:/root$ whoami fukaerii  | cs | 
그러면 이렇게 생성한 유저에 sudo 권한을 부여해보자. 다음과 같이 sudoers 파일을 열어 사용자와 권한을 다음과 같이 부여한다.
1 2  | root@server:/$ sudo visudo  | cs | 
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33  | # # 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 fukaerii 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 # See sudoers(5) for more information on "#include" directives: #includedir /etc/sudoers.d  | cs | 
수정 후 저장은 Ctrl + X 를 통해서 하면 되고, 파일명을 sudoers 로 저장하면 된다.
728x90