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! |
When you log on to a server, you can always try to use following command to get all the priviliges
Code:
sudo su - |
Thank you for the quick reply.
But the sudo command does not work on the server. |
What do you get when you use this command?
|
I get the following error:
-bash: sudo:command not found |
yeah oke, makes sense ;)
Try to install it with this: Code:
# apt-get install sudo Code:
# yum install sudo Go through it and let us know if you get stuck. |
dragonix- I dont think that making semi-random suggestions is a good idea.
kp18- what distro and version are you using? I'd bet that you are using a distro that doesnt use sudo by default. Why are you trying to use sudo? |
Quote:
|
Thanks for the replies.
@dragonix: I have already tried those commands.Thank you. @cascade9: The output of 'uname -a' is: Linux client 3.2.0-32-generic-pae #51-Ubuntu SMP Wed Sep 26 21:54:23 UTC 2012 i686 i686 i386 GNU/Linux The 'date' on the server is not updated. The server does not permit me to update using the normal '#date' command. Hence the need for sudo. |
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. |
Thank you cascade9. I will look into it.
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 #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 |
@TobiSGD:Thank you for the reply.
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. |
All times are GMT -5. The time now is 10:38 PM. |