automatic change default working directory after graphical login
Linux - DesktopThis forum is for the discussion of all Linux Software used in a desktop context.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
automatic change default working directory after graphical login
short description of the problem:
I would like to automagically change the working directory from $HOME to, for example, /proj/$USER after the $USER logs into the machine via the graphical (GUI) login (aka gdm). So, when the $USER opens new terminal, he/she should be in /proj/$USER and __not__ in $HOME
[side note: I am using tsch as my $SHELL]
oo: no, putting 'cd /proj/$USER' into .cshrc is _not_ the solution
oo: yes, putting 'cd /proj/$USER' into .login works if the user logs into the machine using CLI login and then starts the desktop with 'startx' OR if he/she logs to the machine via ssh|telnet. It does not work for gdm (aka graphical login)
oo: no, adding 'cd /proj/$USER' to the file Default or Xsession does __not__ work.
Hate to say it but changing the $HOME variable is the only thing I would think could do that. The only other guess if I were using bash would be to add this to the bashrc file of the user if you were using gnome-terminal
alias gnome-terminal='gnome-terminal --working-directory=/proj/$USER'
or a different alias for xterm or other terminals.
I've never really used tcsh but i figure you can translate such things.
Not the best answer but hopefully it will help somewhat.
Hate to say it but changing the $HOME variable is the only thing I would think could do that. The only other guess if I were using bash would be to add this to the bashrc file of the user if you were using gnome-terminal
alias gnome-terminal='gnome-terminal --working-directory=/proj/$USER'
or a different alias for xterm or other terminals.
I've never really used tcsh but i figure you can translate such things.
Not the best answer but hopefully it will help somewhat.
Thanks for the reply. I will try the suggested trick. I have to try it under different conditions... for example... launching gnome-terminal from another script, from xterm, as a shell from gnuplot, from calc, from octave, via ssh, from remothe machine.. etc etc.
It has to be robust because I do not have time and motivation to babysit all the LAB users ( 40 lab workstation and 100+ users).
We will see how it goes.
Yes I can translate your hint to tcsh. No problem. Thanks
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.