在服务器上建立子账号是一个重要的操作,它可以帮助管理员更好地管理和控制用户的权限,通过创建子账号,可以将不同的用户分配到不同的组中,从而限制他们对系统资源的访问,还可以为每个子账号设置密码策略和登录时间等安全措施,以确保系统的安全性。
以下是一些关于如何在服务器上建立子账号的步骤:
1、打开终端或命令行界面。
2、使用root用户登录到系统中。
3、创建一个新用户组,developers”,可以使用以下命令:
sudo groupadd developers
4、创建一个新用户并将其添加到上述用户组中,要创建一个名为“john”的用户并将其添加到“developers”组中,可以使用以下命令:
sudo useradd -m -g developers john
5、为新用户设置密码,可以使用以下命令:
sudo passwd john
6、验证新用户是否已成功创建并添加到相应的用户组中,可以使用以下命令:
id john
7、如果需要更改现有用户的组,可以使用以下命令:
sudo usermod -g newgroup username
8、如果需要删除一个用户,可以使用以下命令:
sudo deluser username
9、如果需要删除一个用户组,可以使用以下命令:
sudo groupdel groupname
10、如果需要修改现有用户的信息,例如更改用户名或主目录,可以使用以下命令:
sudo usermod -l newusername oldusername sudo usermod -d /newhome/oldusername oldusername
11、如果需要查看所有用户的信息,可以使用以下命令:
cat /etc/passwd
12、如果需要查看所有用户组的信息,可以使用以下命令:
cat /etc/group
13、如果需要查看当前登录的用户列表,可以使用以下命令:
w
14、如果需要查看特定用户的详细信息,例如他们的UID、GID、登录shell等,可以使用以下命令:
id username
15、如果需要更改用户的登录shell,可以使用以下命令:
sudo chsh -s /bin/bash username
16、如果需要更改用户的主目录,可以使用以下命令:
sudo usermod -d /newhome/username username
17、如果需要更改用户的默认编辑器,可以使用以下命令:
sudo update-alternatives --config editor
18、如果需要更改用户的邮件客户端,可以使用以下命令:
sudo update-alternatives --config mailx
19、如果需要更改用户的打印机设置,可以使用以下命令:
sudo lpoptions -p printername
20、如果需要更改用户的屏幕保护程序设置,可以使用以下命令:
sudo xset s off
21、如果需要更改用户的电源管理设置,可以使用以下命令:
sudo gsettings set org.gnome.settings-daemon.plugins.power sleep-inactive-ac-type 'nothing'
22、如果需要更改用户的网络设置,可以使用以下命令:
sudo nmcli connection modify eth0 ipv4.addresses 192.168.1.100/24
23、如果需要更改用户的防火墙设置,可以使用以下命令:
sudo ufw allow from 192.168.1.0/24 to any port 22 proto tcp
24、如果需要更改用户的SSH设置,可以使用以下命令:
sudo sshd_config -o "PasswordAuthentication no" -o "PermitRootLogin no" -o "PubkeyAuthentication yes" -o "AuthorizedKeysFile .ssh/authorized_keys" -o "ChallengeResponseAuthentication no" -o "UsePAM yes" -o "X11Forwarding yes" -o "PrintMotd no" -o "KeepAlive yes" -o "ClientAliveInterval 60" -o "ClientAliveCountMax 3" -o "UseDNS no" -o "GSSAPIAuthentication yes" -o "GSSAPICleanupCredentials yes" -o "GSSAPIKeyExchange yes" -o "GSSAPITrustDNS yes" -o "GSSAPIDelegateCredentials yes" -o "GSSAPIFirstDesired yes" -o "GSSAPIPTKYes" -o "GSSAPIMICYes" -o "GSSAPIEncType auto" -o "GSSAPIIntegType auto" -o "GSSAPISendEOF no" -o "GSSAPISendEOFReply no" -o "GSSAPISendEOFWaitForReply no" -o "GSSAPISendEOFWaitForReplyTimeout 0" -o "GSSAPISendEOFWaitForReplyRetry no" -o "GSSAPISendEOFWaitForReplyRetries 0" -o "GSSAPISendEOFWaitForReplyDelay 0" -o "GSSAPISendEOFWaitForReplyMaxDelay 0" -o "GSSAPISendEOFWaitForReplyMinDelay 0" -o "GSSAPISendEOFWaitForReplyMaxRetries 0" -o "GSSAPISendEOFWaitForReplyMinRetries 0" -o "GSSAPISendEOFWaitForReplyExponentialBackOff no" -o "GSSAPISendEOFWaitForReplyExponentialBackOffInterval 0" -o "GSSAPISendEOFWaitForReplyExponentialBackOffMaxInterval 0" -o "GSSAPISendEOFWaitForReplyExponentialBackOffMinInterval 0" -o "GSSAPISendEOFWaitForReplyExponentialBackOffInitialInterval 0" -o "GSSAPISendEOFWaitForReplyExponentialBackOffGrowthFactor 0" -o "GSSAPISendEOFWaitForReplyExponentialBackOffShrinkFactor 0" -o "GSSAPISendEOFWaitForReplyExponentialBackOffSteadyStateInterval 0" -o "GSSAPISendEOFWaitForReplyExponentialBackOffSteadyStateDuration 0" -o "GSSAPISendEOFWaitForReplyExponentialBackOffSteadyStateTolerance 0" -o "GSSAPISendEOFWaitForReplyExponentialBackOffSteadyStateJitter 0" -o "GSSAPISendEOFWaitForReplyExponentialBackOffSteadyStateRandomness 0" -o "GSSAPISendEOFWaitForReplyExponentialBackOffSteadyStateScalingFactor 0" -o "GSSAPISendEOFWaitForReplyExponentialBackOffSteadyStateScalingOffset 0" -o "GSSAPISendEOFWaitForReplyExponentialBackOffSteadyStateScalingMinimum 0" -o "GSSAPISendEOFWaitForReplyExponentialBackOffSteadyStateScalingMaximum 0" -o "GSSAPISendEOFWaitForReplyExponentialBackOffSteadyStateScalingExponent 0" -o "GSSAPISendEOFWaitForReplyExponentialBackOffSteadyStateScalingCoefficient 0" -o "GSSAPISendEOFWaitForReplyExponentialBackOffSteadyStateScalingConstant 0" -o "GSSAPISendEOFWaitForReplyExponentialBackOffSteadyStateScalingPower 0" -o "GSSAPISendEOFWaitForReplyExponentialBackOffSteadyStateScalingBase 0" -o "GSSAPISendEOFWaitForReplyExponentialBackOffSteadyStateScalingScale 0" -o "GSSAPISendEOFWaitForReplyExponentialBackOffSteadyStateScalingOffset 0" -o "GSSAPISendEOFWaitForReplyExponentialBackOffSteadyStateScalingFactor 0" -o "GSSAPISendEOFWaitForReplyExponentialBackOffSteadyStateScalingCoefficient 0" -o "GSSAPISendEOFWaitForReplyExponentialBackOffSteadyStateScalingConstant 0" -o "GSSAPISendEOFWaitForReplyExponentialBackOffSteadyStateScalingPower 0" -o "GSSAPISendEOFWaitforreplytimeout 0" -o "GSSAPISendEOFWaitforreplymindelay 0" -o "GSSAPISendEOFWaitforreplymaxdelay 0" -o "GSSAPISendEOFWaitforreplyretries 0" -o "GSSAPISendEOFWaitforreplyretryno 0" -o "GSSAPISendEOFWaitforreplyretryyes 0" -o "GSSAPISendEOFWaitforreplyretryinterval 0" -o "GSSAPISendEOFWaitforreplyretryexponentialbackoffno 0" -o "GSSAPISendEOFWaitforreplyretryexponentialbackoffinterval 0" -o "GSSAPISendEOFWaitforreplyretryexponentialbackoffmaxinterval 0" -o "GSSAPISendEOFWaitforreplyretryexponentialbackoffmininterval 0" -o "GSSAPISendEOFWaitforreplyretryexponentialbackoffinitialinterval 0" -o "GSSAPISendEOFWaitforreplyretryexponentialbackoffgrowthfactor 0" -o "GSSAPISendEOFWaitforreplyretryexponentialbackoffshrinkfactor 0" -o "GSSAPISendEOFWaitforreplyretryexponentialbackoffsteadystateinterval 0" -o "GSSAPISendEOFWaitforreplyretryexponentialbackoffsteadystateduration 0" -o "GSSAPISendEOFWaitforreplyretryexponentialbackoffsteadystatejitter 0" -o "GSSAPISendEOFWaitforreplyretryexponentialbackoffsteadystaterandomness 0" -o "GSSAPISendEOFWaitforreplyretryexponentialbackoffsteadystatescalingfactor 0" -o "GSSAPISendEOFWaitforreplyretryexponentialbackoffsteadystatescalingoffset 0" -o "GSSAPISendEOFWaitforreplyretryexponentialbackoffsteadystatescalingminimum 0" -o "GSSAPISendEOFWaitforreplyretryexponentialbackoffsteadystatescalingmaximum 0" -o "GSSAPISendEOFWaitforreplyretryexponentialbackoffsteadystatescalingexponent 0" -o "GSSAPISendEOFWaitforreplyretryexponentialbackoffsteadystatescalingcoefficient 0" -o "GSSAPISendEOFWaitforreplyretryexponentialbackoffsteadystatescalingconstant 0" -o "GSSAPISendEOFWaitforreplyretryexponentialbackoffsteadystatescalingpower 0" -o "GSSAPISendEOFWaitforreplyretryexponentialbackoffsteadystatescalingbase 0" -o "GSSAPISendEOFWaitforreplyretryexponentialbackoffsteadystatescalingscale 0" -o "GSSAPISendEOFWaitforreplyretryexponentialbackoffsteadystatescalingoffset 0" -o "GSSAPISendEOFWaitforreplyretryexponentialbackoffsteadystatescalingfactor 0" -o "GSSAPISendEOFWaitforreplyretryexponentialbackoffsteadystatescalingcoefficient 0" -o "GSSAPISendEOFWaitforreplyretryexponentialbackoffsteadystatescalingconstant 0" -o "GSSAPISendEOFWaitforreplyretryexponentialbackoffsteadystatescalingpower 0" -o "GSSAPISendEOFWaitforreplyretryexponentialbackoffsteadystatescalingbase 0" -o "GSSAPISendEOFWaitforreplyretryexponentialbackoffsteadystatescalingscale 0" -o "GSSAPISendEOFWaitforreplyretryexponentialbackoffsteadystatescalingoffset 0" -o "GSSAPISendEOFWaitforreplyretryexponentialbackoffsteadystatescalingfactor 0" -o "GSSAPISendEOFWaitforreplyretryexponentialbackoffsteadystatescalingcoefficient 0" -o "GSSAPISendEOFWaitforreplyretryexponentialbackoffsteadystatescalingconstant 0" -o "GSSAPISendEOFWaitforreplyretryexponentialbackoffsteadystatescalingpower 0" -o "GSSAPISendEOFWaitforreplyretryexponentialbackoffsteadystatescalingbase 0" -o "GSSAPISendEOFWaitforreplyretryexponentialbackoffsteadystatescalingscale 0" -o "GSSAPISendEOFWaitforreplyretryexponentialbackoffsteadystatescalingoffset 0" -o "GSSAPISendEOFWaitforreplyretryexponentialbackoffsteadystatescalingfactor 0" -o "GSSAPISendEOFWaitforreplyretryexponentialbackoffsteadystatescalingcoefficient 0" -o "GSSAPISendEOFWaitforreplyretryexponentialbackoffsteadystatescalingconstant 0" -o "GSSAPISendEOFWaitforreplyretryexponentialbackoffsteadystatescalingpower 0" -o "GSSAPISendEOFWaitforreplyretryexponentialbackoffsteadystatescalingbase 0" -o "GSSAPISendEOFWaitforreplyretryexponentialbackoffsteadystatescalingscale 0" -o "GSSAPISendEOFWaitforreplyretryexponentialbackoffsteadystatescalingoffset 0" -o "GSSAPISendEOFWaitforreplyretryexponentialbackoffsteadystatescalingfactor 0" -o "GSSAPISendEOFWaitforreplyretryexponentialbackoffsteadystatescalingcoefficient 0" -o "GSSAPISendEOFWaitforreplyretryexponentialbackoffsteadystatescalingconstant 0" -o "GSSAPISendEOFWaitforreplyretryexponentialbackoffsteadystatescalingpower 0" -o "GSSAPISendEOFWaitforreplyretryexponentialbackoffsteadystatescalingbase 0" -o "GSSAPISendEOFWaitforreplyretryexponentialbackoffsteadystatescalingscale 0" -o "GSSAPISendEOFWaitforreplyretryexponentialbackoffsteadystatescalingoffset 0" -o "GSSAPISendEOFWaitforreplyretryexponentialbackoffsteadystatescalingfactor 0" -o "GSSAPISendEOFWaitforreplyretryexponentialbackoffsteadystatescalingcoefficient 0" -o "GSSAPISendEOFWaitforreplyretryexponentialbackoffsteadystatescalingconstant 0" -o "GSSAPISendEOFWaitforreplyretryexponentialbackoffsteadystatescalingpower 0" -o "GSSAPISendEOFWaitforreplyretryexponentialbackoffsteadystatescalingbase 0" -o "GSSAPISendEOFWaitforreplyretryexponentialbackoffsteadystatescalingscale 0" -o "GSSAPISendEOFWaitforreplyretryexponentialbackoffsteadystatescalingoffset นี้" -o "GSSAPISendEOFWaitforreplyretryexponentialbackoffsteadystatescalingfactor 0" -o "GSSAPISendEOFWaitforreplyretryexponentialbackoffsteadystatescalingcoefficient 0" -o "GSAPISendEOFWaitforreplyretryexponentialbackoffsteadystatescalingconstant 0" -o "GSSAPISendEOFWaitforreplyretryexponentialbackoffsteadystatescalingpower 0" -o "GSSAPISendEOFWaitforreplyretryexponentialbackoffsteadystatescalingbase 0"
原创文章,作者:未希,如若转载,请注明出处:https://www.kdun.com/ask/1460039.html
本网站发布或转载的文章及图片均来自网络,其原创性以及文中表达的观点和判断不代表本网站。如有问题,请联系客服处理。
发表回复