Cách tạo user trên Ubuntu từ dòng lệnh

 
 
Cách tạo user trên Ubuntu từ dòng lệnh

Ubuntu là một bản phân phối Linux được ưa chuộng hiện nay, bài viết sẽ hướng dẫn các bạn cách tạo user trên hệ điều hành này.

 
 

Hướng dẫn

  • 1

    useradd <username>

    Lệnh này giúp bạn tạo user. Nếu không có tham số kèm theo user này sẽ không có password.

    Để chỉ định home directory cho user, bạn thêm tham số -d, tham số -m sẽ tạo home directory nếu thư mục này chưa tồn tại.

    Tham số -p để chỉ định password cho user. Nếu không dùng tham số này bạn cũng có thể dùng lệnh passwd để tạo password cho user.

    sudo useradd -d /home/testuser -m testuser

    sudo passwd testuser

  • 2

    adduser <username>

    Lệnh này đơn giản hơn useradd bởi bạn không cần phải đưa vào các tham số, lệnh này sẽ tự động hiển thị các tùy chọn để bạn nhập vào.

    geek@ubuntuServ:/etc/skel$ sudo adduser thegeek
    Password:
    Adding user 'thegeek'…
    Adding new group 'thegeek' (1004).
    Adding new user 'thegeek' (1004) with group 'thegeek'.
    Creating home directory '/home/thegeek'.
    Copying files from '/etc/skel'
    Enter new UNIX password:
    Retype new UNIX password:
    No password supplied
    Enter new UNIX password:
    Retype new UNIX password:
    passwd: password updated successfully
    Changing the user information for thegeek
    Enter the new value, or press ENTER for the default
    Full Name []: The Geek
    Room Number []: 0
    Work Phone []: 555-1212
    Home Phone []: 555-1212
    Other []:
    Is the information correct? [y/N] y

 
 
Hãy click like để theo dõi các bài viết mới của vnHow trên Facebook!
 
 
 

Bài liên quan

 
 

Tham khảo

 

Bình luận

 
 
 

Hệ điều hành

 
 
 
 
 
Bạn phải đăng nhập để thực hiện chức năng này.