If you are using bash, ash, ksh or some other Bourne-style shell, you can add ABC="123"; export ABC
in your .profile
file (${HOME}/.profile). This is the default situation on most unix installations, and in particular on Debian.
If your login shell is bash, you can use .bash_profile
(${HOME}/.bash_profile) or .bash_login
instead.
Use /etc/environment
file for setting the environment variables. Then add the following line inside the /etc/environment file: ABC="123"
. Now the ABC variable will be accessible from all the user sessions. To test the variable output first refresh the environment variable using the command source /etc/environment
and run echo $ABC
.
source: https://perlgeek.de/en/article/set-up-a-clean-utf8-environment
We choose to use en_US locale as the standard. Therefore we run:
sudo export LC_ALL=en_US.UTF-8
sudo locale-gen
This will set a clean UTF-8 environment. Alternatively we can write the export command into /etc/environment
or .bashrc
.
To answer the literal question: no, there is no default password. Usually by default an account will have an "invalid" password, that is, a password hash that will not be matched by any password at all. In order to be able to log in, a password must be explicitly specified, e.g. by running passwd
for the account in question.
source: https://www.cyberciti.biz/open-source/command-line-hacks/linux-run-command-as-different-user/
- option 1:
runuser -l userNameHere -c 'command'
- option 2:
su - userNameHere -c 'command'
Option 2 has less overhead. Beware than executing commmands that start a process in the foreground will make the bash sesion hang on that process and therefore you will not return to the original user untill the process goes to background or stops.
source: http://serverfault.com/questions/351046/run-script-as-user-who-has-nologin-shell
run su -s /bin/bash -c '/path/to/your/script' testuser
source: https://www.cyberciti.biz/tips/nohup-execute-commands-after-you-exit-from-a-shell-prompt.html
run nohup <command> &
This will allow the command-script to continue running in the background.
reference: https://wiki.debian.org/Permissions
source: https://www.howtogeek.com/50787/add-a-user-to-a-group-or-second-group-on-linux/
usermod -a -G <groupname> username