I have a mount from Linux to a windows network drive that works great. Except for one thing: every 90 days my password changes and I have to go in and recreate the mount like so:
sudo mount -t cifs \ -o 'vers=3.0,username=USER,domain=ads-domain,password=PASSWORD' \ '//10.1.0.111/home/user' \ /data/mounts/backup
Works great but I don't want to keep recreating it. can I use a credentials file like this:
vi ~/smb.cred username=user_name password=password domain=domain_name # Set the permissions to only allow the owner to access the file: chown user_name ~/smb.cred chmod 600 ~/smb.cred
Or I already have an
.env file in
~ that my python stuff uses. could I do something really weird like this?
sudo mount -t cifs \ -o 'vers=3.0,username=USER,domain=ads-domain,password=$(python get_password_from_env.py USER)' \ '//10.1.0.111/home/user' \ /data/mounts/backup
I don't know. What's the best way to make the credentials dynamic here?