This is a very short post and relies on the knowledge that UID of root user is always 0 regardless of the name of the root account. If the effective UID returned by
id -u is not zero, the user is not executing the script with root privileges. Below simple code can be used to check against if script is running as root or not:
if [ "$(id -u)" -ne 0 ]; then
echo 'This script must be run by root user' > &2
root is the user name or account that by default has access to all commands and files on a Linux or other Unix-like operating system. It is also referred to as the root account, root user and the superuser. The root account is the most privileged on the system and has absolute power over it (i.e., complete access to all files and commands). Among root’s powers are the ability to modify the system in any way desired and to grant and revoke access permissions (i.e., the ability to read, modify and execute specific files and directories) for other users, including any of those that are by default reserved for root.
It is therefore, many times, you need to login as root in order to perform certain administrative actions. Continue reading “Become root user on Linux servers in Azure”
We had this situation other day with one of the IIS websites. We were troubleshooting SSL on the site, and after that we were able to resolve that SSL issue. However, we found that the site only works from within the server. But from outside, we were getting connection refused. We checked and re-checked certificates, certificate trust store, windows firewall rules, event logs and firewall logs, SNI, bindings but still same issue.
While checking ports, we observed that port 443 is in listening state only for IP address 127.0.0.1 but not for 0.0.0.0 (Note that 0.0.0.0 means all possible IP address, only ipv4). So it would require to be listening on the same, so that clients can connect to it. Continue reading “Error: IIS Website not listening on 0.0.0.0:443”
I have found some time to sit together and make a list of most used linux commands by me on a personal basis. I’m sharing the same over here (this in no way intends to be a complete list or reference list, so please don’t feel offensive). I hope you can find the same useful:
dmesg (boot message)
dmesg | less (view line by line)
sudo lshw (complete hardware info about computer!)
uname -a (server info)
cat /etc/*release (OS)
df -hT (mounted file systems)
mount -l (lists all mounted filesystems)
env | sort (environmental variables) Continue reading “List of most used linux commands for various purposes”
Most current Linux distributions (RHEL, CentOS, Fedora, Ubuntu 16.04 and higher) use systemd to manage which services start when the system boots. We can use below commands to configure docker to start on boot:
$ sudo systemctl enable docker
To disable this behavior, use disable instead.
$ sudo systemctl disable docker
If you are running on Ubuntu 14.04 LTS or lower, you can use upstart to help you with same:
$ echo manual | sudo tee /etc/init/docker.override