array=(one two three)
echo "Printing first object in array." #Replace 0 with the place number of the array item
echo "Whole array"
echo "Array indexes"
Printing first object in array.
one two three
0 1 2
The following commands are helpful for seeing if a user is currently logged in, or when the last time a user was on.
The “who” command give information about users that are currently logged in
[steve@localhost ~]$ who root pts/0 2018-12-14 15:05 (192.168.1.23) steve pts/2 2018-12-14 12:09 (192.168.1.25) [steve@localhost ~]$
The last command shows a list of the last logged in users
[steve@localhost ~]$ last steve pts/2 192.168.1.25 Fri Dec 14 15:05 still logged in root pts/1 192.168.1.23 Fri Dec 14 12:09 - 12:09 (00:00) steve tty1 Thu Nov 8 10:02 - 10:15 (00:13) reboot system boot 4.7.0.x Thu Nov 8 09:01 - 10:12 (01:01) wtmp begins Tue Oct 11 09:01:57 2018 [steve@localhost ~]$
You would typically use this along with the systems firewall to allow a port through. Guide for firewalld and iptables. If you change it in the firewall and fail to add/edit it in semanage you can potentially get weird behavior like sshd not wanting to start after changing the port.
semanage port -a -t ssh_port_t -p tcp 2222
The above command allows the sshd service to start, using port 2222.