I'm looking for a way to set something like a default path for a user on my server. So for example I've the user XYZ. When I login now with this user on my server, I want to be directly in a defined folder instead on the base dir of this user.

Is this possible? If yes, how?

  • Just to clarify: you're talking about the current directory the user will be in, not the environment variable PATH that governs where programs will be looked for, right? – Ulrich Schwarz Apr 10 at 13:00
  • Yes, about the file directory the user is in – Mr. Jo Apr 10 at 13:01

You can try this way :
Add this line in sshd_config

ForceCommand { cd 'defined folder/' ; "${SHELL:-sh}" ; }

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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