Hey everyone! I'm trying to figure out the best way to set up some bash aliases on a freshly installed Debian server so that they actually stick around after reboots and are applied every time I log in. I've attempted several methods, but I've been running into permission issues every time. I've tried adding the aliases to my .bashrc, /etc/bash.bashrc, and even created a .bash_aliases file, but no luck. I even put a script in /etc/profile.d, thinking that might work, but that stopped functioning too. I'm sure it's something simple, but I'm struggling to get it right. Any help would be greatly appreciated! Thanks!
2 Answers
It sounds like you're having a hard time with permissions. The usual spot for your aliases is indeed your ~/.bashrc. If you're not able to edit it, try running `ls -l ~/.bashrc` to check the permissions, and use `id` to see which user you're logged in as. You should have ownership over that file.
If you're creating accounts and want those aliases to automatically be in place, put them in /etc/skel/.bashrc. Every time a new user is created, it copies the contents over. Just remember, this only works for new accounts, so for existing ones, you’ll have to manually manage the permissions and ownership after modifying it.
Don't forget about /etc/profile.d/*.sh! This allows you to set up aliases or environment variables globally for all users without being restricted to just new ones. It’s a great way to manage system-wide configurations.