[SOLVED] How do I add myself as a sudo user on a server (from the client)?
Linux - NewbieThis Linux forum is for members that are new to Linux.
Just starting out and have a question?
If it is not in the man pages or the how-to's this is the place!
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
How do I add myself as a sudo user on a server (from the client)?
Hi all,
I will start off saying that I am a newbie to linux and not familiar with it. Here is my problem:
From my linux client, I connect to a server(via ssh) which boots with an image stored in the client.I needed to add myself as the sudo user in the server(in order to run certain commands which otherwise I don't have permission to). I modified the sudoers file of the server(which is at the client and will be copied to the server when booting) using the command:
sudo visudo
When I reboot, I can now see my username in the sudoers file in the server.But it still does not allow me to use the sudo command. What am I doing wrong?
I also tried a few other things by looking up the internet, but it will get very confusing if I list them all here, but nothing worked!
If its ubuntu, its got to be using sudo...Ubuntu is the only distro I know of that disables the root account and enables sudo out of the box (apart from other ubuntu based distros).
If you dont have sudo permissions, you probbly need to contact whoever runs it to get them.
Last edited by cascade9; 11-12-2012 at 05:31 PM.
Reason: typos
I also looked into the possibility of running the 'date' command from the root, by using 'su' command to go to root. But when it asked for password and I gave mine, it said 'authentication failure'. I edited the /etc/shadow file of the server (that I can edit and view from the client)for the 'root' not to have any password.But even this did not work. Considering the fact that I also don't have sudo permissions, is there a way to overcome this hurdle of getting to the root using 'su'?
Sorry, but all this doesn't make any sense. In post #1 you state that you changed something in the sudoers file using the command
Code:
sudo visudo
In post #3 you state that the sudo command is not working, giving you a command not found error. Only one of that statements can be true.
In post #11 you state that you have edited the shadow file, but since you don't have root permissions on that system you shouldn't be able to edit anything in /etc (especially files like sudoers), unless someone has seriously borked the permissions on the server system.
So, please show us the permissions of the files in /etc, you can do that with
Code:
ls -lh /etc
and show us the line you added to the sudoers file. Did you have done this on the client or the server. It seems that here is some serious misconception in the way of successful server administration, or you have a seriously misconfigured system.
All the files that I edited (sudoers, shadow) are on a directory in the client.The server copies these files from the client into its '/etc' directory every time it reboots(like I have mentioned in the original post). In fact when I login into the server, I can view these changes that I made. The problem was once I am in the server it did not allow me to change the 'date' because I dont have the sudo rights, and logging in as root using 'su' also did not work as it was not accepting my password(or the password I mentioned in the /etc/shadow file). I am sorry if all this sounds very confusing,because it is.. I dont know how I can explain it better.
All said and done, now the problem is actually solved, but only through a workaround! The root password was not working when I logged into the server with my user name and then gave the command 'su'. However the same password worked when I directly login to the server using:
'ssh <server.ip.address> -l root'
So I was able to login as root user on server and set the date with the above command. But I still can't figure out why this worked and the other method did not.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.