Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

I have a rackspace server and I'm having problems with configuration. I need to lock it down and throw away the key, because right now I can only login with root to do anything substantial. I also am set up on MySQL with my root username and password and would like to change this.

I have created a new user and given him a home directory for /var/www so I can administer my website through FTP. However, I can't run any sudo commands as that user (it returns an error, and tells me the action would be logged)

I want to create a catch-all account that starts in a typical home directory like /Users/justin but with sudo privileges to escalate to install and update software packages. I also want to fix MySQL so it has its very own login/pass (because right now it's root/rootpass)

This is on Rackspace so I can only access the server through SSH. OS is Ubuntu 11.10. Thanks for your time.

share|improve this question
add comment

1 Answer

up vote 2 down vote accepted

By default MySQL on Ubuntu and every other distribution has it's own user mysql/mysql. It's normally locked for login.

If you need to have a user with privileges to run stuff as root you will need to add that user to /etc/sudoers file via command visudo. If you need that user to have full root privileges you will need to make that user part of the admin group which will give him privileges to run any command as root. That is the configuration out of the box for an Ubuntu system.

As far as MySQL is concerned if you would like to another user have full admin rights within the database all you will need to do is as root user in MySQL execute

GRANT ALL ON * TO user IDENTIFIED BY 'password' WITH GRANT OPTION;
GRANT ALL ON *.* to user IDENTIFIED BY 'password' WITH GRANT OPTION;

That should do it.

share|improve this answer
    
quick question, I've run the visudo command and added the user in this format in two places- in #user privilege specification and #members of the admin group may gain root privileges: user ALL=(ALL:ALL) ALL - is this sufficient? How may I also go about making sure my user is in the admin group? sorry for my noobishness –  Justin Amberson Feb 16 '12 at 21:08
    
If you are adding user to the admin group you don't need individual privileges. To add user to admin group all you will need usermod -a -G admin <username>. –  Karlson Feb 16 '12 at 21:22
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.