LinuxQuestions.org
Share your knowledge at the LQ Wiki.
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 12-23-2009, 09:09 PM   #1
linus72
LQ Guru
 
Registered: Jan 2009
Location: Gordonsville-AKA Mayberry-Virginia
Distribution: Slack14.2/Many
Posts: 5,573

Rep: Reputation: 470Reputation: 470Reputation: 470Reputation: 470Reputation: 470
Best way to make a "user" thru terminal that has almost-root priviledges?


OK
so I'm making different Debian Live interations and I wanna know how to use

useradd thru terminal?

useradd seems very confusing?

I tried simple adduser name
and I had alot of issues like it said

user has no password,etc
even after giving user passwd?

so, i think useradd is better but am too dumb to use it?

basically, I need to make a user that has near-root priveledges??

example, lets say my username is "guest"

how do I make a group and user for guest and give "guest"
all priviledges like mounting drives,etc??

thanks
 
Old 12-23-2009, 09:18 PM   #2
~sHyLoCk~
Senior Member
 
Registered: Jul 2008
Location: /dev/null
Posts: 1,173
Blog Entries: 12

Rep: Reputation: 129Reputation: 129
Code:
 useradd -m -G [groups] -s [login_shell] [username]
Example:

Code:
useradd -m -G users,audio,lp,video,wheel,power -s /bin/bash linus72
Then use:
Code:
passwd linus72
to set the password.
Then you can edit /etc/sudoers file and add the user to give him sudo privilege.
Code:
linus72   ALL=(ALL) ALL
 
Old 12-23-2009, 09:19 PM   #3
linus72
LQ Guru
 
Registered: Jan 2009
Location: Gordonsville-AKA Mayberry-Virginia
Distribution: Slack14.2/Many
Posts: 5,573

Original Poster
Rep: Reputation: 470Reputation: 470Reputation: 470Reputation: 470Reputation: 470
Thanks shylock

ok, but what all groups exist?

I need the user to have close to root or root privs
its a rescue cd so user needs root priviledges/?
 
Old 12-23-2009, 09:24 PM   #4
~sHyLoCk~
Senior Member
 
Registered: Jul 2008
Location: /dev/null
Posts: 1,173
Blog Entries: 12

Rep: Reputation: 129Reputation: 129
Quote:
cat /etc/group
Can show the groups.
You can create the rescue mode in such a way so that the USER has to chroot to his root environment and then perform the rescue operation,e.g. grub re-install,etc.
 
Old 12-23-2009, 09:24 PM   #5
linus72
LQ Guru
 
Registered: Jan 2009
Location: Gordonsville-AKA Mayberry-Virginia
Distribution: Slack14.2/Many
Posts: 5,573

Original Poster
Rep: Reputation: 470Reputation: 470Reputation: 470Reputation: 470Reputation: 470
see, basically my problem is this:

I made a debian live iso from the no-X standard iso
and added fluxbox and many many rescue apps

Problem?
Most of the rescue apps, like testdisk, magicrescue, fsarchiver,etc
all run in a teerminal

so, these apps must be run as root in twerminal

well, I dont know the commands to open a term as root in debian live?

any ideas?
note that in debian live no user passwords or root password either
 
Old 12-23-2009, 09:28 PM   #6
linus72
LQ Guru
 
Registered: Jan 2009
Location: Gordonsville-AKA Mayberry-Virginia
Distribution: Slack14.2/Many
Posts: 5,573

Original Poster
Rep: Reputation: 470Reputation: 470Reputation: 470Reputation: 470Reputation: 470
Heres an example entry for a root twerminal in fluxbox menu
Code:
[exec] (X-Terminal as root (GKsu\)) {echo -e '(X-Terminal as root (GKsu\)) {/usr/bin/gksu -u root /usr/bin/x-terminal-emulator\} </usr/share/pixmaps/gksu-debian.xpm>' >> /home/user/.fluxbox/statistics && /usr/bin/gksu -u root /usr/bin/x-terminal-emulator} </usr/share/pixmaps/gksu-debian.xpm>
that works

now, heres my rescue menu, which must open these apps as root

Code:
[begin]
  [submenu] (Magic Menu)
    [exec] (X-Terminal as root (GKsu\)) {echo '(X-Terminal as root (GKsu\)) {/usr/bin/gksu -u root /usr/bin/x-terminal-emulator\} </usr/share/pixmaps/gksu-debian.xpm>' >> /home/user/.fluxbox/statistics && /usr/bin/gksu -u root /usr/bin/x-terminal-emulator} </usr/share/pixmaps/gksu-debian.xpm>
      [exec] (X-Terminal as root (GKsu\)) {echo '(X-Terminal as root (GKsu\)) {/usr/bin/gksu -u root /usr/bin/x-terminal-emulator\} </usr/share/pixmaps/gksu-debian.xpm>' >> /home/user/.fluxbox/statistics && /usr/bin/gksu -u root /usr/bin/x-terminal-emulator} </usr/share/pixmaps/gksu-debian.xpm>
      [exec] (DD_Rescue) {echo -e '(ddrescue) { x-terminal-emulator "ddrescue" -e su-to-root -u root -c /bin/dd_rescue\} <>' >> /home/user/.fluxbox/statistics &&  x-terminal-emulator "ddrescue" -e su-to-root -u root -c /bin/dd_rescue} <>
      [exec] (Dvdisaster) {echo -e '(Dvdisaster) {/usr/bin/dvdisaster\} </usr/share/pixmaps/dvdisaster.xpm>' >> /home/user/.fluxbox/statistics && /usr/bin/dvdisaster} </usr/share/pixmaps/dvdisaster.xpm>
      [exec] (Recover) {echo -e '(recover) { x-terminal-emulator "recover" -e su-to-root -u root -c /usr/sbin/recover\} <>' >> /home/user/.fluxbox/statistics &&  x-terminal-emulator "recover" -e su-to-root -u root -c /usr/sbin/recover} <>
      [exec] (Testdisk) {echo -e '(testdisk) { x-terminal-emulator "testdisk" -e su-to-root -u root -c /usr/sbin/testdisk\} <>' >> /home/user/.fluxbox/statistics &&  x-terminal-emulator "testdisk" -e su-to-root -u root -c /usr/sbin/testdisk} <>
      [exec] (FSArchiver) {echo -e '(fsarchiver) { x-terminal-emulator "fsarchiver" /usr/sbin/fsarchiver\} <>' >> /home/user/.fluxbox/statistics &&  x-terminal-emulator "fsarchiver" /usr/sbin/fsarchiver} <>
      [exec] (MagicRescue) {echo -e '(magicrescue) { /usr/bin/magicrescue\} <>' >> /home/user/.fluxbox/statistics && /usr/bin/magicrescue} <>
  [end]
[end]
now of those commands open the terms as root?
help!
 
Old 12-24-2009, 03:33 AM   #7
repo
LQ 5k Club
 
Registered: May 2001
Location: Belgium
Distribution: Arch
Posts: 8,529

Rep: Reputation: 899Reputation: 899Reputation: 899Reputation: 899Reputation: 899Reputation: 899Reputation: 899
Just want to add, debian has also
Quote:
adduser
it's interactive.
 
Old 12-24-2009, 04:59 AM   #8
linus72
LQ Guru
 
Registered: Jan 2009
Location: Gordonsville-AKA Mayberry-Virginia
Distribution: Slack14.2/Many
Posts: 5,573

Original Poster
Rep: Reputation: 470Reputation: 470Reputation: 470Reputation: 470Reputation: 470
OK

heres my cat /etc/group

Quote:
root:x:0:
daemon:x:1:
bin:x:2:
sys:x:3:
adm:x:4:
tty:x:5:
disk:x:6:
lp:x:7:
mail:x:8:
news:x:9:
uucp:x:10:
man:x:12:
proxy:x:13:
kmem:x:15:
dialout:x:20:
fax:x:21:
voice:x:22:
cdrom:x:24:
floppy:x:25:
tape:x:26:
sudo:x:27:
audio:x:29:
dip:x:30:
www-data:x:33:
backup:x:34:
operator:x:37:
list:x:38:
irc:x:39:
src:x:40:
gnats:x:41:
shadow:x:42:
utmp:x:43:
video:x:44:
sasl:x:45:
plugdev:x:46:
staff:x:50:
games:x:60:
users:x:100:
nogroup:x:65534:
libuuid:x:101:
crontab:x:102:
messagebus:x:103:
fuse:x:104:
gdm:x:105:
haldaemon:x:106:
powerdev:x:107:
netdev:x:108:
Debian-exim:x:109:
ssh:x:110:
backuppc:x:111:
partimag:x:112:
ssl-cert:x:113:
stb-admin:x:114:
so, I need the user to have near root privi's for like the backuppc and partimage server, etc?

should I just make group/user as shylock said above?
 
Old 12-24-2009, 05:11 AM   #9
linus72
LQ Guru
 
Registered: Jan 2009
Location: Gordonsville-AKA Mayberry-Virginia
Distribution: Slack14.2/Many
Posts: 5,573

Original Poster
Rep: Reputation: 470Reputation: 470Reputation: 470Reputation: 470Reputation: 470
OK

I did this and thats what happened-

Code:
root@503box:~/Desktop/DebianLive# chroot squashfs-root/ useradd -m -G sys,admin,users,mail,news,cdrom,floppy,tape,man,uucp,www-data,backup,video,plugdev,games,crontab,fuse,haldaemon,ssh,backuppc,partimag,stb-admin,ssl-cert,audio,lp,video,wheel,power -s /bin/bash guest
useradd: unknown group admin
useradd: unknown group wheel
useradd: unknown group power
root@503box:~/Desktop/DebianLive#
is that ok or what?
 
Old 12-24-2009, 05:12 AM   #10
repo
LQ 5k Club
 
Registered: May 2001
Location: Belgium
Distribution: Arch
Posts: 8,529

Rep: Reputation: 899Reputation: 899Reputation: 899Reputation: 899Reputation: 899Reputation: 899Reputation: 899
When you are in rescue mode, is everything loaded, you need to execute ?
Or are you at a limited shell ?
 
Old 12-24-2009, 05:15 AM   #11
repo
LQ 5k Club
 
Registered: May 2001
Location: Belgium
Distribution: Arch
Posts: 8,529

Rep: Reputation: 899Reputation: 899Reputation: 899Reputation: 899Reputation: 899Reputation: 899Reputation: 899
Quote:
is that ok or what?
Don't think so....
If you look at your /etc/group
the groups admin, wheel and power don't exist.
Seems to me you need to create them.
 
Old 12-24-2009, 05:17 AM   #12
~sHyLoCk~
Senior Member
 
Registered: Jul 2008
Location: /dev/null
Posts: 1,173
Blog Entries: 12

Rep: Reputation: 129Reputation: 129
Well Live CDs don't need root passwords, take Ubuntu Live CD for an example. You just type sudo command, and it can execute a command with root privilege. So, I'm guessing you can add an user guest, then add him to sudoers like:

Quote:
guest ALL=(ALL) ALL
%wheel ALL=(ALL) NOPASSWD: ALL
Uncomment wheel group or if it ain't there add it. And make sure you add the user in wheel group. Now everytime user uses sudo, he doesn't need password.
 
Old 12-24-2009, 05:55 AM   #13
linus72
LQ Guru
 
Registered: Jan 2009
Location: Gordonsville-AKA Mayberry-Virginia
Distribution: Slack14.2/Many
Posts: 5,573

Original Poster
Rep: Reputation: 470Reputation: 470Reputation: 470Reputation: 470Reputation: 470
What?

I wonder why those groups arent there already?

so, what all groups do i need to create for rescue cd?

groups admin, wheel and power

what othrs?
 
Old 12-24-2009, 06:10 AM   #14
~sHyLoCk~
Senior Member
 
Registered: Jul 2008
Location: /dev/null
Posts: 1,173
Blog Entries: 12

Rep: Reputation: 129Reputation: 129
Wait a minute, what are you trying to do exactly? Your aim is to create an user who can run commands with root privilege right?

Quote:
Problem?
Most of the rescue apps, like testdisk, magicrescue, fsarchiver,etc
all run in a teerminal

so, these apps must be run as root in twerminal
So why add the users in various groups? I am getting confused now, did you consider my last post? I think adding the user to wheel group will be sufficient.
 
Old 12-24-2009, 06:19 AM   #15
linus72
LQ Guru
 
Registered: Jan 2009
Location: Gordonsville-AKA Mayberry-Virginia
Distribution: Slack14.2/Many
Posts: 5,573

Original Poster
Rep: Reputation: 470Reputation: 470Reputation: 470Reputation: 470Reputation: 470
alright

I didnt know adding to wheel group would do it

see, being that its a debian live creation
by default there are no passwords for root and there is no real user
the user "user" is created at boot
as with ubuntu
and you get autologin,etc

and your right, in debian live you also just type sudo su and your root

however, this thread goes to a question I had about the fluxbox menu
which will not let me call up a term as root without password
OR I dont know the syntax to get it to?

cause see here the way the menu is made it doesnt work as root?
only the gksu entry works?

Code:
[begin]
  [submenu] (Magic Menu)
    [exec] (X-Terminal as root (GKsu\)) {echo '(X-Terminal as root (GKsu\)) {/usr/bin/gksu -u root /usr/bin/x-terminal-emulator\} </usr/share/pixmaps/gksu-debian.xpm>
      [exec] (DD_Rescue) {echo -e '(ddrescue) { x-terminal-emulator "ddrescue" -e su-to-root -u root -c /bin/dd_rescue\} <>
      [exec] (Dvdisaster) {echo -e '(Dvdisaster) {/usr/bin/dvdisaster\} </usr/share/pixmaps/dvdisaster.xpm>
      [exec] (Recover) {echo -e '(recover) { x-terminal-emulator "recover" -e su-to-root -u root -c /usr/sbin/recover\} <>
      [exec] (Testdisk) {echo -e '(testdisk) { x-terminal-emulator "testdisk" -e su-to-root -u root -c /usr/sbin/testdisk\} <>
      [exec] (FSArchiver) {echo -e '(fsarchiver) { x-terminal-emulator "fsarchiver" -e su-to-root -u root -c /usr/sbin/fsarchiver\} <>
      [exec] (MagicRescue) {echo -e '(magicrescue) { x-terminal-emulator "testdisk" -e su-to-root -u root -c /usr/bin/magicrescue\} <>
  [end]
[end]
AND
how do i create those groups, wheel, power,etc?

Last edited by linus72; 12-24-2009 at 06:22 AM.
 
  


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



Similar Threads
Thread Thread Starter Forum Replies Last Post
How do I enforce in Red hat linux that only root user be a member of the "root" group sultf Linux - Security 4 01-08-2009 04:42 PM
Standard commands give "-bash: open: command not found" even in "su -" and "su root" mibo12 Linux - General 4 11-11-2007 10:18 PM
How do I make my programs start "on top" of the terminal that starts them? martinr Fedora 2 04-08-2006 03:20 AM
Postgresql error FATAL: user "root" does not exist" cgetty Ubuntu 4 06-21-2005 02:11 PM
[Redhat] make "admin" account same privledges as "root" Bi0haZarD Linux - Networking 20 01-12-2005 10:47 AM

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

All times are GMT -5. The time now is 10:26 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