On 01/02/2015 17:07, Peter Humphrey wrote: > On Sunday 01 February 2015 14:17:04 Alan McKinnon wrote: >> On 01/02/2015 02:18, Adam Carter wrote: >>> If you've su'd to root, try 'su -' instead. >>> >>> Thank you, that was it? >>> What difference does it make and why on some boxes it has to be "su >>> -" and on others simple "su" works. >>> >>> Read 'man su'. I dont really understand this stuff well enough, but a >>> 'login shell', that is, one started by /bin/login, is setup with a >>> different environment to a shell that's started by su (or by, say, >>> cron). This is why a shell command or script may work for you when >>> you're logged in, but not if you run it from cron. I'm sure other's can >>> explain it more correctly and fully. >> >> This stuff is complex the first time you run into it. > > --->8 > > [Much good advice] > > I think of it simply like this: "su" switches user, and that's all; "su -" > gives you the full environment of the user you switch to. >
Indeed, that is the heart of it. Your version above is perfect for the tl;dr people :-) -- Alan McKinnon alan.mckin...@gmail.com