انتقل إلى المحتوى

الدروس الخوادم مبتدئ1 دقائق قراءة

How to Create a Sudo User on Ubuntu

Stop working as root: create a new user on Ubuntu or Debian, grant sudo rights, copy your SSH key, and confirm administrative access works.

بواسطة فريق تحرير ZSOLNET آخر تحديث

هذه الصفحة غير متاحة بالعربية بعد، لذا تُعرض بالإنجليزية.

أهم النقاط

  • Day-to-day work as root makes mistakes and break-ins more dangerous.
  • Members of the sudo group can run admin commands with their own password.
  • Copy your SSH key to the new user before disabling root login.

Create the user

Log in as root, then:

adduser deploy

Set a strong password and press Enter through the optional details.

Grant sudo rights

usermod -aG sudo deploy

Copy your SSH key

If you log in as root with a key, give the new user the same access:

rsync --archive --chown=deploy:deploy ~/.ssh /home/deploy

Test

Open a new terminal:

ssh deploy@203.0.113.10
sudo whoami    # should print: root

Once this works, you can disable direct root login (PermitRootLogin no in /etc/ssh/sshd_config).

الأسئلة الشائعة

What's the difference between su and sudo?

su switches to another user (often root) entirely. sudo runs a single command with elevated rights and logs it, which is safer and auditable.

Does this work on Debian?

Yes. On Debian you may need to install sudo first with apt install sudo.

شارك X LinkedIn Facebook

الدخول إلى حسابك

أدِر نطاقاتك واستضافتك وفواتيرك من مكان واحد.

اتصال آمن مباشرة مع منطقة العملاء في ZSOLNET.

افتح لوحة تحكم ZSOLNET

ليس لديك حساب؟