Login to "tcsh" doesn't change to $HOME directory.
Linux - ServerThis forum is for the discussion of Linux Software used in a server related 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.
Login to "tcsh" doesn't change to $HOME directory.
Hello!
After adding a new user (through NIS server), when running "su new_user"
the current directory doesn't chanes to $HOME.
The shell in use is "tcsh" (for historical reasons: too much to rewrite for "bash"),
after "su new_user" running "echo $HOME" displays the correct $HOME directory,
running "cd" without arguments changes correctly to the $HOME directory.
Other, previously existing users also running "tcsh" have no such problem.
And, for the new user, the same problem exists on two different servers.
There is no ".login" file in our home directories.
I looked at the files /etc/csh.login and /etc/login.defs but didn't see there
anything that hints to the initial directory after login.
Any ideas, what causes "tcsh" to "cd" (or, in this case, not to "cd") to $HOME?
Wouldn't that be with the -l option to start a login shell and have an environment like a normal login?
Code:
su -l newuser
If you plan to migrate, despite Bash being the default, do take a look at Zsh, Fish, and Oil to see the current state of available shells. Myself, while I started out on tcsh, I quickly moved to Bash and have been there for ages. Lately I am even dabbling with Zsh.
Yes, I've read that adding the "-l" switch forces "login shell".
But why the same "su username" command behaves differently for old users and the new user?
I can live with
alias su 'su -l'
but I have a feeling that it's like sweeping the problem under the carpet: I still don't
understand the reason for same command behaving differently for different users.
Other users have no alias for "su" but somehow using this command without
the "-l" (or any other) switch it behaves like login shell.
Each tcsh runs the system /etc/csh.cshrc then the user's .tcshrc or .cshrc
A login tcsh additionally runs the system /etc/csh.login then the user's .login
If different users have different behavior with a plain su then look at their .tcshrc files if present otherwise their .cshrc files.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.