I have various scripts that I would like to make available to several other people to use with their own accounts. I keep these scripts in a github repo.
Let’s say I have a bash script to ssh into computer via:
username=crzyuser123
ssh -XY $username@specialcomputer.com
Now I’m not crazy, I don’t store my password (using rsa pub/private keys) in the script, but let’s say that it’s a very handy script that I use and update all the time, and other people also use all the time (but they clearly have a different username).
What I’d like to be able to do is say, “git pull, then edit this one line in the file so that your username is there, then forget it!” And each time they git pull to update their repo, it leaves that line unchanged.
They could, of course, update this one line every time they update the repo, but that seems to be a huge pain. I also need to convey any solution in not-too-difficult way.
What’s the best practice to making this situation easiest for all involved?
I’ve figured out a way to not store the username in the bash script. Here’s the bash solution I’ve implemented:
This allows for the script to be run automatically (assuming that the current user is the same as the supercomputer username). And if someone needs to enter a different username, the script will take that one.