Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

Typically I would create a user account and in the home folder, place the cd command in the ~/.bashrc file. For system users, however, with on home folders, the /etc/bash.bashrc file is used instead and with multiple system users I need a more conditional approach.

Can the /etc/bash.bashrc file know which user is executing it, and change directories on login based on which user I've logged in as?

These system users are never logged in as remotely, only using su.

share|improve this question

1 Answer 1

You can set the home folder for a user in /etc/passwd. Find the line with that user name and change the sixth entry which represents the absolute path to the directory where the user will be in when he log in.

See also: Understanding /etc/passwd File Format

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.