-   Linux - Newbie (
-   -   really weird!!! su doesn't work right (

granny 02-26-2003 01:40 PM

really weird!!! su doesn't work right
hey all, I have a RH7.3 box, and for some reason recently, whenever I am logged in as a normal user and issue su, it asks for password. I type it in and it goes through. However, I cannot edit any files, cannot issue a lot of the commands. But the weird thing is, if I log directly in as root (instead of su) everything works fine. Any thought??? Thanks in advance

zulu1_hl 02-26-2003 01:51 PM

Try using "/bin/su - root" to bring in the root user's environment when switching from another user.

granny 02-26-2003 04:47 PM

no luck, thanks though. It's really starting to frustrate me!!!

Texicle 02-26-2003 05:04 PM

When at command prompt do you type "su" or "su -" (without the quotes)? If just su, then try:

su -

I would suggest checking that your user account has permission to "su" but you've already stated that you can su to root, but can't do root stuff. This is really bizarre. Are you doing this in a terminal console in X or in just plain command line terminal? Try getting out of X and logging in as your user then "su -" and see what happens. If it works without X, it might be your Xterm (or whatever console you're using) that has problems.

Additionally, when you su - to root, you no longer stay in the directory that your user account was in--you go to the root's home directory. If, as granny, you're in /home/granny, your prompt should look similar to:


Then, you do su, or su - you'll get:


For the sake of example I'll say you're using the vi text editor. Now you want to edit a file that is located in /home/granny and you just type:

[root@hostname]~# vi somefile

You'll get a new file generated as it doesn't exist there. You'll have to add the path to the file as follows:

[root@hostname]~# vi /home/granny/somefile

If you want to stay in the same directory as your user before the switch to root type:

su -m

The only reason I'm suggesting this is because I've made this mistake more than a few times when installing software from source. Hope this helps.:D

granny 02-26-2003 05:23 PM

It happens in both X window and through an actual console without X running. Even if I shut off X (init 3) I'll give it a shot. Thanks

All times are GMT -5. The time now is 05:34 AM.