Linux - Newbie This 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.
Are you new to LinuxQuestions.org? Visit the following links:
Site Howto |
Site FAQ |
Sitemap |
Register Now
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.
 |
GNU/Linux Basic Guide
This 255-page guide will provide you with the keys to understand the philosophy of free software, teach you how to use and handle it, and give you the tools required to move easily in the world of GNU/Linux. Many users and administrators will be taking their first steps with this GNU/Linux Basic guide and it will show you how to approach and solve the problems you encounter.
Click Here to receive this Complete Guide absolutely free. |
|
 |
11-12-2012, 06:46 AM
|
#1
|
|
LQ Newbie
Registered: Nov 2012
Posts: 6
Rep: 
|
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!
|
|
|
|
11-12-2012, 06:50 AM
|
#2
|
|
Member
Registered: Nov 2012
Location: Belgium
Distribution: Ubuntu 12.04
Posts: 69
Rep:
|
When you log on to a server, you can always try to use following command to get all the priviliges
|
|
|
|
11-12-2012, 06:53 AM
|
#3
|
|
LQ Newbie
Registered: Nov 2012
Posts: 6
Original Poster
Rep: 
|
Thank you for the quick reply.
But the sudo command does not work on the server.
|
|
|
|
11-12-2012, 07:13 AM
|
#4
|
|
Member
Registered: Nov 2012
Location: Belgium
Distribution: Ubuntu 12.04
Posts: 69
Rep:
|
What do you get when you use this command?
|
|
|
|
11-12-2012, 07:17 AM
|
#5
|
|
LQ Newbie
Registered: Nov 2012
Posts: 6
Original Poster
Rep: 
|
I get the following error:
-bash: sudo:command not found
|
|
|
|
11-12-2012, 07:44 AM
|
#6
|
|
Member
Registered: Nov 2012
Location: Belgium
Distribution: Ubuntu 12.04
Posts: 69
Rep:
|
yeah oke, makes sense
Try to install it with this:
Code:
# apt-get install sudo
Or, if that didn't worked
Got it from this link
Go through it and let us know if you get stuck.
|
|
|
|
11-12-2012, 07:52 AM
|
#7
|
|
Senior Member
Registered: Mar 2011
Location: Brisneyland
Distribution: Debian, aptosid
Posts: 2,913
|
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?
|
|
|
|
11-12-2012, 08:10 AM
|
#8
|
|
Member
Registered: Nov 2012
Location: Belgium
Distribution: Ubuntu 12.04
Posts: 69
Rep:
|
Quote:
Originally Posted by cascade9
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?
|
I'm just giving him a link that might be helpful..
|
|
|
|
11-12-2012, 09:52 AM
|
#9
|
|
LQ Newbie
Registered: Nov 2012
Posts: 6
Original Poster
Rep: 
|
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.
|
|
|
|
11-12-2012, 01:32 PM
|
#10
|
|
Senior Member
Registered: Mar 2011
Location: Brisneyland
Distribution: Debian, aptosid
Posts: 2,913
|
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
|
|
|
1 members found this post helpful.
|
11-12-2012, 02:29 PM
|
#11
|
|
LQ Newbie
Registered: Nov 2012
Posts: 6
Original Poster
Rep: 
|
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'?
|
|
|
|
11-12-2012, 03:16 PM
|
#12
|
|
Moderator
Registered: Dec 2009
Location: Hanover, Germany
Distribution: Slackware
Posts: 12,159
|
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 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 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.
|
|
|
|
11-14-2012, 05:02 AM
|
#13
|
|
LQ Newbie
Registered: Nov 2012
Posts: 6
Original Poster
Rep: 
|
@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.
|
|
|
|
| Thread Tools |
Search this Thread |
|
|
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
All times are GMT -5. The time now is 03:58 PM.
|
|
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.
|
Latest Threads
LQ News
|
|