# Automatically change directory when switching to su



## Aknot (May 5, 2021)

Hello,

Is it possible to automatically change working directory when `su` via Putty?
I tried to do that when logging in with a wheel account, by making changes in Putty, but that didn't work.

Thank you,


----------



## covacat (May 5, 2021)

su -l will get you to /root (simulate a login)
su -m will preserve your environment, shell history etc

depends on what are you trying to accomplish


----------



## Argentum (May 5, 2021)

Aknot said:


> Is it possible to automatically change working directory when `su` via Putty?
> I tried to do that when logging in with a wheel account, by making changes in Putty, but that didn't work.


`su -`


----------

