Understanding Root Access & Permissions

With a VPS or Dedicated Server, you have root access - the highest level of privilege on a Linux system. This means you can install any software, modify any file, and change any setting. With this power comes the responsibility to use it wisely.

What is Root?

The root user is the superuser account on Linux. It has unrestricted access to the entire system. While it is necessary for administrative tasks like installing software, configuring services, and managing users, running as root for everyday tasks is risky because any mistake (or malicious command) can affect the entire system.

Using Sudo Instead of Root

Best practice is to create a regular user account and grant it sudo privileges. Sudo allows you to execute individual commands with root-level permissions by prefixing them with sudo. This reduces the chance of accidental damage and provides an audit trail of privileged commands.

To create a new user with sudo access on Ubuntu/Debian: adduser yourusername followed by usermod -aG sudo yourusername. On AlmaLinux/Rocky: adduser yourusername followed by usermod -aG wheel yourusername.

Linux File Permissions

Every file and directory on Linux has permissions that control who can read, write, and execute it. Permissions are divided into three categories: owner, group, and others. You can view permissions with ls -la and modify them with chmod and chown. Understanding permissions is essential for securing your server and ensuring applications function correctly.

Common Permission Values

755: Owner can read, write, and execute. Group and others can read and execute. Standard for directories and scripts.

644: Owner can read and write. Group and others can only read. Standard for regular files.

600: Owner can read and write. No access for group or others. Used for sensitive files like SSH keys and configuration files containing passwords.

Warning:  Never set permissions to 777 (full access for everyone) on production files or directories. This is a major security risk and can allow any user or process on the system to modify or delete your data

 

Was this article helpful?