LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 05-09-2008, 03:22 PM   #1
sysslack_linux
LQ Newbie
 
Registered: Oct 2007
Location: Sweden
Distribution: I favor Slackware, CentOS and Debian
Posts: 25

Rep: Reputation: Disabled
sudo with alias


Hi I wonder if someone good in sudo can explain how to use

Runas_Alias DB = #1000 (where #1000 should be an user id)
user #1000 is johan on the system.
I have read a lot of sudo and get the basics, but this I don't understand. Especially Howto use this option

Runas_Alias DB = #1000

I have use visudo to edit the file.
Is this done to anything useful?
this is my sudoers file.
sudoers file.
#
# This file MUST be edited with the 'visudo' command as root.
#
# See the sudoers man page for the details on how to write a sudoers file.
#

# Host alias specification
Host_Alias HB =pingvin
# User alias specification

# Cmnd alias specification

# Defaults specification

# Runas alias specification
Runas_Alias DB = #1000
# User privilege specification
#root ALL=(ALL) ALL
johan ALL=(ALL) ALL
pernilla HB= (DB) ALL

# Uncomment to allow people in group wheel to run all commands
# %wheel ALL=(ALL) ALL

# Same thing without a password
# %wheel ALL=(ALL) NOPASSWD: ALL

# Samples

help would be appreciated
 
Old 05-09-2008, 08:24 PM   #2
GrapefruiTgirl
LQ Guru
 
Registered: Dec 2006
Location: underground
Distribution: Slackware64
Posts: 7,594

Rep: Reputation: 556Reputation: 556Reputation: 556Reputation: 556Reputation: 556Reputation: 556
I haven't got a clue about sudo, but I am wondering if that pound sign ( # ) before the 1000 is causing any trouble?
Technically, that would be commenting out the user number, wouldn't it?

SVA

Last edited by GrapefruiTgirl; 05-09-2008 at 08:24 PM. Reason: typo
 
Old 05-09-2008, 09:08 PM   #3
bigrigdriver
LQ Addict
 
Registered: Jul 2002
Location: East Centra Illinois, USA
Distribution: Debian stable
Posts: 5,908

Rep: Reputation: 356Reputation: 356Reputation: 356Reputation: 356
Have you read the sudoers man page? It's explained there.
 
Old 05-10-2008, 03:07 AM   #4
sysslack_linux
LQ Newbie
 
Registered: Oct 2007
Location: Sweden
Distribution: I favor Slackware, CentOS and Debian
Posts: 25

Original Poster
Rep: Reputation: Disabled
Actually the problem is solved.
man page sudo
sudo [-HPSb] [-a auth_type] [-c class|-] [-p prompt] sudo [-HPSb] [-a auth_type] [-c class|-] [-p prompt] [-u username|#uid]
{-e file [...] | -i | -s | command}


I interpreted this line [-u username|#uid]
as sudo -u username or sudo #uid, not sudo -u \#uid

So the thing is either the man page is wrong written or I got it wrong from the start howto read man page synopsis!

Last edited by sysslack_linux; 05-10-2008 at 05:28 PM.
 
Old 05-11-2008, 02:51 AM   #5
Tinkster
Moderator
 
Registered: Apr 2002
Location: earth
Distribution: slackware by choice, others too :} ... android.
Posts: 23,067
Blog Entries: 11

Rep: Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928
The man page is correct, albeit somewhat terse; it doesn't mention
that bash will interpret the # as a comment if you don't escape it.

It's not a sudo (or sudo man-page) problem ... ;}

What you got wrong is not to think about the shell you're
using when running those commands.


Cheers,
Tink
 
Old 05-12-2008, 11:34 AM   #6
sysslack
Member
 
Registered: Feb 2006
Posts: 69

Rep: Reputation: 15
Thank you for your explanation.
No actually I did escape shell correct! \#uid
, but what i did not understand with synopsis was sudo -u \#uid (with option -u) so I mean I interpreted [-u username|#uid] as sudo -u username or just sudo \#uid (without -u), and that last option obviously was wrong! But from now on I know!
 
Old 05-12-2008, 11:47 AM   #7
GrapefruiTgirl
LQ Guru
 
Registered: Dec 2006
Location: underground
Distribution: Slackware64
Posts: 7,594

Rep: Reputation: 556Reputation: 556Reputation: 556Reputation: 556Reputation: 556Reputation: 556
Quote:
Originally Posted by sysslack View Post
Thank you for your explanation.
No actually I did escape shell correct! \#uid
, but what i did not understand with synopsis was sudo -u \#uid (with option -u) so I mean I interpreted [-u username|#uid] as sudo -u username or just sudo \#uid (without -u), and that last option obviously was wrong! But from now on I know!
Yeek those green colors are rotten! lol, before someone gets bent out of shape from going cross-eyed from them, kindly maybe use BOLD rather than that icky green color.

Cheers

SVA
 
Old 05-12-2008, 01:18 PM   #8
Tinkster
Moderator
 
Registered: Apr 2002
Location: earth
Distribution: slackware by choice, others too :} ... android.
Posts: 23,067
Blog Entries: 11

Rep: Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928
Quote:
Originally Posted by sysslack View Post
Thank you for your explanation.
No actually I did escape shell correct! \#uid
, but what i did not understand with synopsis was sudo -u \#uid (with option -u) so I mean I interpreted [-u username|#uid] as sudo -u username or just sudo \#uid (without -u), and that last option obviously was wrong! But from now on I know!
The colours *are* nasty, alright. :}

And why do have two user-accounts? And what did you dig
the older one up for this response? :D


Cheers,
Tink
 
Old 05-13-2008, 04:16 PM   #9
sysslack
Member
 
Registered: Feb 2006
Posts: 69

Rep: Reputation: 15
Smile

Yes! You may be right about the colour. I will consider using bold next time. But the main reason for this whole discussion was that I wanted to understand how sudo works and at the same moment deeping the understanding generally for howto read / understand the synopsis of man page and hopefully at the same time help somebody else, that is not always so absolut and clear for a newbie. I got to know about Linux august 2005 and learned a great deal, but sure there is still alot to learn.
cheers!

Last edited by sysslack; 05-13-2008 at 04:23 PM.
 
Old 05-13-2008, 08:47 PM   #10
Tinkster
Moderator
 
Registered: Apr 2002
Location: earth
Distribution: slackware by choice, others too :} ... android.
Posts: 23,067
Blog Entries: 11

Rep: Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928
Heh. First used Linux around 98, but there sure still is a lot to learn ;}


Cheers,
Tink
 
1 members found this post helpful.
  


Reply



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 On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
LXer: The Ultimate Sudo FAQ — To Sudo Or Not To Sudo? LXer Syndicated Linux News 13 04-13-2013 01:36 AM
sudo, mount and alias ikarus Linux - General 3 04-18-2008 10:55 AM
LXer: sudo, or not sudo: that is the question LXer Syndicated Linux News 0 02-07-2008 05:40 PM
Restricting Editing in Sudo (Advanced Sudo Question) LinuxGeek Linux - Software 4 11-04-2006 03:20 PM
Alias question (2 commands for one alias) gflores Linux - Newbie 3 01-21-2006 12:40 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 09:07 PM.

Main Menu
Advertisement
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
Open Source Consulting | Domain Registration