2

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.

1 Answer 1

2

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.

2
  • 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
    – Daddy
    Feb 16, 2012 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, 2012 at 21:22

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .