su differences?

What is the difference between

su -

Someone told me to use su -.

I don’t use the cli much but it is the way I back up my home directory by using resync as root via rsync -av /home/flamebait /bu/flamebait

I always use su to do that.

The - sets the environment, else it stays in the current directory and doesn’t read in roots profile etc. Log in via su the run the command env, then exit and run su - and rerun the env command…see the difference (also when running su - you will be in /root not pwd)

Much less baggage entailed as su -

And here I was just changing directories using cd when needed.

I really try and stay out of / and any sub directories except home when root :smiley:

Thanks as always Malcolm.

There’s no reason to run rsync as root anyway if you have the ownership on /bu/flamebait set correctly.

Well under 11.1 I was not allowed to use rsync -av /home/flamebait /bu/flamebait unless I was root. I tested and indeed that behavior is no longer the case in 11.3

I’ve never had problems using rsync as a non-root user. Maybe it was just the way you set up /bu/flamebait under 11.1.

At this point it’s a mystery as that drive was wiped and reformatted to ext4 and given a new name so I can’t check how it was set up.
Now there is a different drive mounted as /bu with a /flamebait directory owned by flamebait under the group users. So the path is /bu/flamebait/flamebait
I try and run rsync at least once a day then I go in and delete all the **** my .mozilla cache in the backup every once and a while.

FlameBait wrote:
> I really try and stay out of / and any sub directories except home when
> root :smiley:

you should never need root powers in your home

CAVEAT: [posted via NNTP w/openSUSE 10.3]