LinuxQuestions.org
Help answer threads with 0 replies.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
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

Reply
 
Search this Thread
Old 11-12-2012, 06:46 AM   #1
kp18
LQ Newbie
 
Registered: Nov 2012
Posts: 6

Rep: Reputation: Disabled
Unhappy 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!
 
Old 11-12-2012, 06:50 AM   #2
dragonix
Member
 
Registered: Nov 2012
Location: Belgium
Distribution: Ubuntu 12.04
Posts: 69
Blog Entries: 6

Rep: Reputation: 1
When you log on to a server, you can always try to use following command to get all the priviliges

Code:
sudo su -
 
Old 11-12-2012, 06:53 AM   #3
kp18
LQ Newbie
 
Registered: Nov 2012
Posts: 6

Original Poster
Rep: Reputation: Disabled
Thank you for the quick reply.
But the sudo command does not work on the server.
 
Old 11-12-2012, 07:13 AM   #4
dragonix
Member
 
Registered: Nov 2012
Location: Belgium
Distribution: Ubuntu 12.04
Posts: 69
Blog Entries: 6

Rep: Reputation: 1
What do you get when you use this command?
 
Old 11-12-2012, 07:17 AM   #5
kp18
LQ Newbie
 
Registered: Nov 2012
Posts: 6

Original Poster
Rep: Reputation: Disabled
I get the following error:
-bash: sudo:command not found
 
Old 11-12-2012, 07:44 AM   #6
dragonix
Member
 
Registered: Nov 2012
Location: Belgium
Distribution: Ubuntu 12.04
Posts: 69
Blog Entries: 6

Rep: Reputation: 1
yeah oke, makes sense

Try to install it with this:
Code:
# apt-get install sudo
Or, if that didn't worked
Code:
# yum install sudo
Got it from this link
Go through it and let us know if you get stuck.
 
Old 11-12-2012, 07:52 AM   #7
cascade9
Senior Member
 
Registered: Mar 2011
Location: Brisneyland
Distribution: Debian, aptosid
Posts: 3,718

Rep: Reputation: 903Reputation: 903Reputation: 903Reputation: 903Reputation: 903Reputation: 903Reputation: 903Reputation: 903
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?
 
Old 11-12-2012, 08:10 AM   #8
dragonix
Member
 
Registered: Nov 2012
Location: Belgium
Distribution: Ubuntu 12.04
Posts: 69
Blog Entries: 6

Rep: Reputation: 1
Quote:
Originally Posted by cascade9 View Post
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..
 
Old 11-12-2012, 09:52 AM   #9
kp18
LQ Newbie
 
Registered: Nov 2012
Posts: 6

Original Poster
Rep: Reputation: Disabled
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.
 
Old 11-12-2012, 01:32 PM   #10
cascade9
Senior Member
 
Registered: Mar 2011
Location: Brisneyland
Distribution: Debian, aptosid
Posts: 3,718

Rep: Reputation: 903Reputation: 903Reputation: 903Reputation: 903Reputation: 903Reputation: 903Reputation: 903Reputation: 903
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.
Old 11-12-2012, 02:29 PM   #11
kp18
LQ Newbie
 
Registered: Nov 2012
Posts: 6

Original Poster
Rep: Reputation: Disabled
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'?
 
Old 11-12-2012, 03:16 PM   #12
TobiSGD
Moderator
 
Registered: Dec 2009
Location: Hanover, Germany
Distribution: Gentoo
Posts: 15,438
Blog Entries: 2

Rep: Reputation: 4001Reputation: 4001Reputation: 4001Reputation: 4001Reputation: 4001Reputation: 4001Reputation: 4001Reputation: 4001Reputation: 4001Reputation: 4001Reputation: 4001
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.
 
Old 11-14-2012, 05:02 AM   #13
kp18
LQ Newbie
 
Registered: Nov 2012
Posts: 6

Original Poster
Rep: Reputation: Disabled
@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.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Ubuntu Server 10.04 CLI Headless server | Allowing user to SUDO and Hosting Mediawiki wulfsburg Ubuntu 2 06-09-2012 01:58 AM
[SOLVED] How do I add a user to be able to sudo? george-lappies Slackware 17 05-28-2011 01:54 PM
How to give a user only ftp server privilege using sudo? dolceinter1 Linux - Newbie 1 11-05-2008 07:56 AM
could not add the windows client in SLES9 running ldap server ponselvan Linux - Networking 0 03-07-2007 10:45 PM
Refresh client user list at autentication client/server network. robertoneto123 Linux - Networking 0 11-11-2003 10:38 AM


All times are GMT -5. The time now is 10:54 AM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration