Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!


Click here to return to the 'Faster User Switching of a different kind' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
Faster User Switching of a different kind
Authored by: MordEth on Mar 16, '04 11:07:38AM

actually, with the proper permissions, it's entirely possible for you to cd into the other account...you'd just still be writing files as you (and not the other account), and if you wanted the other account to own the files, you could do "chown -R user ~user" as root (either via su or sudo). i mirror my girlfriend's webpage and help her work on it in more or less this manner, since i setup a group that we're both in, and i generally write files from Photoshop directly into her web directory. [unfortunately for this hint, Photoshop writes as the logged in user.]

another note...if you actually have different environment files for the other account (the names of these files would vary depending on which shell you're using, but if you're using 10.3's default bash, they'd be ~/.bash_profile, ~/.bashrc, and ~/.bash_logout, plus anything you call from those files), you'd want to use "su - user", rather than "su user". without the -, su keeps your environment, not the user's that you're switching to. a good example: "su - user" will put you in their home directory, while "su user" will keep you in whichever dir you happen to be in when you use the command. this is useful to note if you take advantage of the alias built-in (command).

so one can do things like:

alias 'chweb'='chmod 604 *.html *.php* *.phtml *.xml *.jpg *.png *.gif *.css *.txt *.ssi *.pdf *.doc *.rtf *.mp3 *.mov *.swf *.js 2> /dev/null'
alias 'www'='cd ~/web_directory'

and be able to set this sort of thing per account. i use a horrific number of aliases, so i break them into files by category, and it's easy to source them with ~/.bash_profile or ~/.bashrc like so:

[ -r alias_file ] && source alias_file

(if it can read your alias file, it sources [or loads] it.)

hopefully this helps anyone that's interested in using this hint.



[ Reply to This | # ]