LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Desktop (https://www.linuxquestions.org/questions/linux-desktop-74/)
-   -   automatic change default working directory after graphical login (https://www.linuxquestions.org/questions/linux-desktop-74/automatic-change-default-working-directory-after-graphical-login-639676/)

primorec 05-03-2008 06:01 PM

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.

/etc/gdm/PostLogin/Default
/etc/gdm/PreSession/Default
/etc/gdm/Xsession

oo: yes, I did read all relevant posts in 'Click Here to Find Similar Threads'.

oo: no, I do not want to change variable $HOME to point to /proj/$USER

oo: no, I do not want to modify /etc/passwd file

Simply put, I am out of ideas. Any hint, RTFM pointer or solution is appreciated.

Igor

anon099 05-03-2008 08:33 PM

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.

primorec 05-03-2008 09:12 PM

Quote:

Originally Posted by padlamoij (Post 3141649)
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


All times are GMT -5. The time now is 03:17 PM.