Managing Users and Hostname on Ubuntu Server
创始人
2024-11-14 13:35:00
0

Tutorial: Managing Users and Hostname on Ubuntu

1. Change Hostname

To change the hostname of your system:

  1. Edit the hostname file:

    sudo nano /etc/hostname 

    Replace the existing name with your new hostname.

  2. Edit the hosts file:

    sudo nano /etc/hosts 

    Update the line that starts with 127.0.1.1 to reflect the new hostname.

  3. Apply the changes:

    sudo systemctl restart systemd-logind.service 
2. Rename a User

To rename a user:

  1. Rename the user:

    sudo usermod -l new_username old_username 
  2. Rename the home directory (if needed):

    sudo usermod -d /homes/new_username -m new_username 
3. Give Sudo Privileges to a User

To add a user to the sudo group:

sudo usermod -aG sudo username 
4. Add a New User

To add a new user with a home directory in /homes:

  1. Create the directory (if it doesn’t exist):

    sudo mkdir -p /homes 
  2. Add the user:

    sudo useradd -m -d /homes/new_user -s /bin/bash new_user 
  3. Set a password:

    sudo passwd new_user 
5. Set Permissions for Home Directories

Ensure home directories are secure:

  1. Set permissions:

    sudo chmod 700 /homes/new_user 
  2. Set ownership:

    sudo chown new_user:new_user /homes/new_user 

Summary

  • Change hostname by editing /etc/hostname and /etc/hosts.
  • Rename users with usermod.
  • Grant sudo access by adding the user to the sudo group.
  • Add new users with custom home directories in /homes.
  • Set appropriate permissions for security.

If you have any more questions or need further assistance, feel free to ask!

相关内容

热门资讯

值得注意的是!wepoker游... 值得注意的是!wepoker游戏的安装教程,pokemmo脚本,竟然存在有挂(有挂透视)1、进入到w...
来临!哈糖大菠萝挂法,wejo... 来临!哈糖大菠萝挂法,wejoker手机版透视脚本,竟然真的是有挂(有挂总结)1、全新机制【wejo...
明白辅助挂!hhpoker透视... 明白辅助挂!hhpoker透视脚本下载,哈糖大菠萝挂,都是是真的有挂(有挂秘笈)暗藏猫腻,小编详细说...
总结辅助挂!约局吧辅助器,佛手... 总结辅助挂!约局吧辅助器,佛手大菠萝辅助,好像真的有挂(有挂秘诀)1)佛手大菠萝辅助有没有挂:进一步...
此事引发广泛关注!hhpoke... 此事引发广泛关注!hhpoker真的假的,wepoker透视有没有,竟然存在有挂(新版有挂)1、全新...
黑科技辅助挂!wepoker辅... 黑科技辅助挂!wepoker辅助真的假的,扑克之星辅助,果然是真的有挂(有挂规律)进入游戏-大厅左侧...
值得注意的是!aapoker透... 值得注意的是!aapoker透视插件,wepoker私人局开挂视频,真是是有挂(有挂教程)1、每一步...
来临!wpk插件辅助,智星菠萝... 来临!wpk插件辅助,智星菠萝透视,好像确实有挂(真的有挂)1、任何智星菠萝透视透视是真的假的的玩家...
在玩家背景下!佛手在线大菠萝智... 在玩家背景下!佛手在线大菠萝智能辅助器,wepoker辅助软件价格,总是确实有挂(有挂解密)1、佛手...
据玩家消息!有没有人wepok... 据玩家消息!有没有人wepoker,pokerworld软件,切实真的有挂(有挂助手)1、下载好有没...