Excellent - ta. I'm going to try and set up my user account to run what seems to currently be a root user command, ifconfig - which I've found a little annoying not to be able to access as a mortal user. Just a little thing to tryDungeon-Dave wrote:Just a point in note: the "su" command means "switch user", not "super user" - ie: it is used to change to another user account. Most people use it to switch from their user account to become root, so it's commonly mistakenly thought of as the "super-user" command, not the "switch-user" command (yes, you probably know this already!)
In the same vein, the "sudo" actually means "switch-user do" rather than "super-user do". Whilst most people use it to allow mortals to run some commands as root, it is also used to allow ordinary users to run certain commands as another user (non-root).
One example is that some users can be given permissions to shutdown/startup a database - they will need to become the "dba" user rather than "root" to do it. Using sudo they won't need the dba password.
The Official *nix Thread
- RageMatrix
- Baaaaaaa!

- Posts: 5515
- Joined: Fri May 10, 2002 12:52 pm 0
- XBL Gamertag: Jon256
- Location: East Sussex
XBox Gamertag: Jon256
Wii Code: 4849 1090 9042 6725
"Wrapped in metal, wrapped in ivy"
The Official UNIX/Linux Thread
Wii Code: 4849 1090 9042 6725
"Wrapped in metal, wrapped in ivy"
The Official UNIX/Linux Thread
- RageMatrix
- Baaaaaaa!

- Posts: 5515
- Joined: Fri May 10, 2002 12:52 pm 0
- XBL Gamertag: Jon256
- Location: East Sussex
WiteWulf wrote:You've got to remember that *nix has it's background in multiuser systems. Allowing any old grunt to be able to bring network interfaces up and down and change addresses is a Bad Thing.
Hmm....perhaps I won't do that then. Basically I just want an easy way to find out my IP address from the CLI as a user and the only way I know how to do this is through ifconfig, which is presently only available to root. I kinda forgot the config part of ifconfigifconfig can also virtually airwall a machine, functionally disconnecting it from a network.
XBox Gamertag: Jon256
Wii Code: 4849 1090 9042 6725
"Wrapped in metal, wrapped in ivy"
The Official UNIX/Linux Thread
Wii Code: 4849 1090 9042 6725
"Wrapped in metal, wrapped in ivy"
The Official UNIX/Linux Thread
- WiteWulf
- Sheepie Whore

- Posts: 10125
- Joined: Mon Aug 23, 2004 11:20 am 0
- PSN: WiteWulf
- Location: Loughborough(ish)
You could try 'cat /var/lib/dhcp3/dhclient.leases' or something similar. I'm pretty sure you wouldn't need to be root to do that but don't have access to anything other than an OS X machine that uses DHCP to check (all my linux boxen are static).
:::G:::
PSN: WiteWulf
Switch: SW-3941-2878-7584
Steam: WITEWULF66
PSN: WiteWulf
Switch: SW-3941-2878-7584
Steam: WITEWULF66
- dom
- Baaaaa!

- Posts: 1370
- Joined: Wed Feb 09, 2005 1:17 pm 0
- Location: Edinburgh, UK and level 691859
- Contact:
Backticks allow you to run a command and have its output replaced by the shell, so you can do this:
edit: this only works for a system connected to the net, or one on an internal [i.e. NATted] network with a domain name set correctly. Under some distributions, normal users can still run "ifconfig" to obtain the IP address; to extract the address from this output, you might have to do some work with grep and awk, however...
I'm hoping there's a more succinct/efficient way to obtain this than this command from my wifi-connected machine on my internal network:
$ ifconfig ath0 | grep "inet addr" | cut -d":" -f 2 | awk '{print $1}'
192.168.0.171
HTH
Dom
Code: Select all
$ host `hostname`
rowla.nuxx.net has address 204.11.33.41
I'm hoping there's a more succinct/efficient way to obtain this than this command from my wifi-connected machine on my internal network:
$ ifconfig ath0 | grep "inet addr" | cut -d":" -f 2 | awk '{print $1}'
192.168.0.171
HTH
Dom
OMG (or oligodendrocyte myelin glycoprotein) is a molecule found in your central nervous system.
- RageMatrix
- Baaaaaaa!

- Posts: 5515
- Joined: Fri May 10, 2002 12:52 pm 0
- XBL Gamertag: Jon256
- Location: East Sussex
Yup, that seems to work 
XBox Gamertag: Jon256
Wii Code: 4849 1090 9042 6725
"Wrapped in metal, wrapped in ivy"
The Official UNIX/Linux Thread
Wii Code: 4849 1090 9042 6725
"Wrapped in metal, wrapped in ivy"
The Official UNIX/Linux Thread
- dom
- Baaaaa!

- Posts: 1370
- Joined: Wed Feb 09, 2005 1:17 pm 0
- Location: Edinburgh, UK and level 691859
- Contact:
ok, just to be sure what you're trying to do:RageMatrix wrote: I just want an easy way to find out my IP address from the CLI as a user
I assume you want to do this so you can access the *nix machine from another client on the same network by IP address, to use samba or similar... if it's just the local machine itself you want to tak to, clearly "localhost" will suffice, but you probably know that.
Another thing that might help is registering DHCP clients on the local server with its DNS server, but I don't know how to do that, and it woud probably depend on the daemons and their versions in use, i.e. depend on the distro.
edit: ah good, it does the trick
OMG (or oligodendrocyte myelin glycoprotein) is a molecule found in your central nervous system.
- Dungeon-Dave
- Baaaaaa!

- Posts: 3925
- Joined: Thu Aug 04, 2005 12:01 pm 0
- Location: UK
- Contact:
Gahh.... no, the command is available to anyone if it is in their path, just that doing certain things with the command requires escalated privs.RageMatrix wrote:Hmm....perhaps I won't do that then. Basically I just want an easy way to find out my IP address from the CLI as a user and the only way I know how to do this is through ifconfig, which is presently only available to root.
/sbin/ifconfig -a = list IP info. That can be done by anyone
ifconfig eth0 up = bring the interface up. Needs rooty goodness. And root has /sbin in their path.
FWIW, I have a command that does a sudo for me then adds on root's PATH so I get access to the "other" commands without having to type the full path. You want a copy of it?
.. and there was me thinking the correct way involved pointing out I wasn't the DBA, I don't get paid as much as him, yes if you want to start it I can give you access rights to do so since I don't know anything about it and oh dear you've fucked up the production database in one quick move and no I can't do anything about it other than make a copy of /var/log/(secure|auth) that contains the timestamp at which the sudo command was used...tufty wrote:The correct way to start a database is to fill in 15 forms requesting the DBA...
.. my coat? Yes, that long one, which covers my arse, you see....
I ain't no BOFH anymore, but still feel the need to get outside of the blast radius...
Last edited by Dungeon-Dave on Fri Jan 11, 2008 12:20 am 0, edited 1 time in total.
- RageMatrix
- Baaaaaaa!

- Posts: 5515
- Joined: Fri May 10, 2002 12:52 pm 0
- XBL Gamertag: Jon256
- Location: East Sussex
Sure, thanks 
XBox Gamertag: Jon256
Wii Code: 4849 1090 9042 6725
"Wrapped in metal, wrapped in ivy"
The Official UNIX/Linux Thread
Wii Code: 4849 1090 9042 6725
"Wrapped in metal, wrapped in ivy"
The Official UNIX/Linux Thread
- RageMatrix
- Baaaaaaa!

- Posts: 5515
- Joined: Fri May 10, 2002 12:52 pm 0
- XBL Gamertag: Jon256
- Location: East Sussex
Since I've discovered work has a budget exclusively for training purposes, I thought I'd use it to get some Linux training/certification under my belt. There seem to be two main ones, the vendor-specific RedHat Certification path and the LPI (Linux Professonal Institute) path.
Does anyone have any experience with either? Which one is better recognised in the industry - i.e. which one should I do?
Does anyone have any experience with either? Which one is better recognised in the industry - i.e. which one should I do?
XBox Gamertag: Jon256
Wii Code: 4849 1090 9042 6725
"Wrapped in metal, wrapped in ivy"
The Official UNIX/Linux Thread
Wii Code: 4849 1090 9042 6725
"Wrapped in metal, wrapped in ivy"
The Official UNIX/Linux Thread
I did RHCE several years ago.
The exam is split into 3 sections:
Troubleshooting on a live system.
Standard multiple choice questions.
Installation and configuration of a system.
There are some sample questions on http://www.redhat.com/courses/rh300_rhc ... rhce_exam/
Or just look at this:
The exam is split into 3 sections:
Troubleshooting on a live system.
Standard multiple choice questions.
Installation and configuration of a system.
There are some sample questions on http://www.redhat.com/courses/rh300_rhc ... rhce_exam/
Or just look at this:

- lis0r
- Baaaa!

- Posts: 894
- Joined: Tue Jan 10, 2006 9:26 am 0
- Location: The Frozen Wastelands Of The North
Unless I've been smoking magic mushrooms, and forgotten about it, I don't think having permission to run ifconfig, and having permission to reconfigure network interfaces are the same thing. Certainly, most unix boxes I've used will still let you run it (even if it's not in the path) to get a summary of interface configuration.RageMatrix wrote:I kinda forgot the config part of ifconfigPresumably I could just allow this priv for one user, though?
- RageMatrix
- Baaaaaaa!

- Posts: 5515
- Joined: Fri May 10, 2002 12:52 pm 0
- XBL Gamertag: Jon256
- Location: East Sussex
Yeah, I think I tried that myself a while back, but I can't be totally sure.lis0r wrote:Unless I've been smoking magic mushrooms, and forgotten about it, I don't think having permission to run ifconfig, and having permission to reconfigure network interfaces are the same thing. Certainly, most unix boxes I've used will still let you run it (even if it's not in the path) to get a summary of interface configuration.RageMatrix wrote:I kinda forgot the config part of ifconfigPresumably I could just allow this priv for one user, though?
XBox Gamertag: Jon256
Wii Code: 4849 1090 9042 6725
"Wrapped in metal, wrapped in ivy"
The Official UNIX/Linux Thread
Wii Code: 4849 1090 9042 6725
"Wrapped in metal, wrapped in ivy"
The Official UNIX/Linux Thread
- RageMatrix
- Baaaaaaa!

- Posts: 5515
- Joined: Fri May 10, 2002 12:52 pm 0
- XBL Gamertag: Jon256
- Location: East Sussex
Huh - even though I did pretty well on the RH033 questionnaire, they still recommend I take it. The only section I had no real experience with was with task automation. Apparently my knowledge is "spotty" according to the resultspixie wrote:I did RHCE several years ago.
The exam is split into 3 sections:
Troubleshooting on a live system.
Standard multiple choice questions.
Installation and configuration of a system.
There are some sample questions on http://www.redhat.com/courses/rh300_rhc ... rhce_exam/
Or just look at this:
XBox Gamertag: Jon256
Wii Code: 4849 1090 9042 6725
"Wrapped in metal, wrapped in ivy"
The Official UNIX/Linux Thread
Wii Code: 4849 1090 9042 6725
"Wrapped in metal, wrapped in ivy"
The Official UNIX/Linux Thread
If I recall correctly (I probably don't, and even if I do, the underlying mechanisms have probably changed), in order to be able to send stuff over an interface (in either BSD-land or SysV-land), you need to have permissions allowing you to be able to discover that interface's configuration.RageMatrix wrote:Unless I've been smoking magic mushrooms, and forgotten about it, I don't think having permission to run ifconfig, and having permission to reconfigure network interfaces are the same thing. Certainly, most unix boxes I've used will still let you run it (even if it's not in the path) to get a summary of interface configuration.
"massive retard™", "full of shit™", "tiny bitch™", "retarted™", "a bit of a one trick pony™", "petty™", "simple minded idealistic twat™", "miserable humourless fucker™"
