Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

I'm still wrapping my brain around the Ubuntu 'nullify root' user management philosophy (and Linux in general) and I'm wondering if I should 'replace' my root user with a user called 'admin' (which basically has all the powers of the root, when using sudo) and create another user called 'app' that will be the primary user for my app.

Here's the context:

  • I'll be running a LNMP stack on Ubuntu 12.04 Server LTS.
  • There will be only one app running on the server.
  • The 'app' user needs to have SUPER privileges for MySQL.
  • PHP will need to be able to exec() shell commands.
  • The 'app' user will need to be able to transfer files via SFTP.

And I'm thinking this would be the best approach:

  • nullify 'root' user
  • create a user called 'admin' that will be a full sudoer of root, this will be the new "root" user of NGINX, PHP, and MySQL (and all system software)
  • grant SUPER privileges to 'app' in MySQL
  • Grant SFTP privileges to only the 'app' user.

As I'm new to this, and the information I've found in researching it tends to be of a more general nature, I'm wondering if this is a solid approach, or if it's unorthodox in a way that would cause issues down the road.

Thanks in advance for any help.

share|improve this question
add comment

1 Answer 1

up vote 1 down vote accepted

Full sudo permissions should be reserved for actual human users. A user in whose context you plan to run network services primarily doesn't need those. You can also think about disabling the password and login shell for such a purely "virtual" user, by blanking the password field in /etc/shadow and settind the shell in /etc/passwd to /bin/false.

Creating separate users for services, app users, as you call it, is a common technique.

share|improve this answer
    
Thanks, Paul! So, basically, I'll nullify the 'root' user, replace that user with an 'admin' that has full sudoer privileges. And also create a 'virtual' user that will run NGINX, PHP, and MySQL (and nullify their password and shell access), and then create another user called 'app' that I'll grant SUPER privileges to in MySQL? –  AJB Oct 20 '13 at 21:30
    
If you are using Ubuntu the root user is already "nullified" - or unable to log in. Basically its password field is simply locked. You can do the same in any other GNU/Linux distribution, though there might be some situations where some service, i.e. cups insists you provide the password for a root user (which is bad if this password is unusable). Should you run into those situations you can always reactivate a root password temporarily. See man 1 passwd and man 5 passwd for some hints on best practice. –  Paul Hänsch Oct 20 '13 at 21:35
    
Excellent, thanks Paul! –  AJB Oct 20 '13 at 21:36
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.