User Management
Thursday, September 1, 2022 11:51 AM
ssh -i /root/.ssh/id_rsa_
useradd -g rms -G rms -c "manjunath.d@tesco.com" ine12397307 ==> create user with giv
secondary with gcose commants
passwd ine12397307
chage -d 0 ine12397307 => set user first login password change
chage -d 0 ine12397307;chage -l ine12397307
chage -M -1 dioneftp ===> set password never Expiry
chage -l krishna ==> list the user paswword change date and password never Expiry or not
tesco@123
adduser dioneftp
usermod -aG wheel veeamflr ===> add existing user in any secondary group
cat /etc/passwd
useradd -u 10029 -c "RMS Server Service account" rms
useradd -m -u 10100 -g rms -G rms -c "Sankaralingam Moorthy" inc22914473
useradd -m -u 10101 -g rms -G rms -c "Gaurab Dasgupta" xf31
useradd -m -u 10102 -g rms -G rms -c "Komma Jahnavi Priya" inc22914125
useradd -m -u 10103 -g rms -G rms -c "Balamurugan Dhanabalan" gph3
useradd -m -u 10104 -g rms -G rms -c "Prabu Selvaraj" yu16
useradd -m -u 10105 -g rms -G rms -c "Tenju Varghese" inc22912412
useradd -m -u 10106 -g rms -G rms -c "Manikandan Manickam" inc22913804
useradd -m -u 10107 -g rms -G rms -c "L Arun Kumar" inc22913823
useradd -m -u 10108 -g rms -G rms -c "Gopinath" zc40
chown -R rms:root /appl/
visudo
vi /etc/ssh/sshd_config
systemctl restart sshd
clear
passwd inc22914473
chage -d 0 inc22914473
passwd xf31
_ukirtb100 ukirdbw24
ven group primary and
vi /etc/ssh/sshd_config
systemctl restart sshd
clear
passwd inc22914473
chage -d 0 inc22914473
passwd xf31
[root@plvmcspldbconn0 ~]# id cbk_s_piadm5
uid=9524(cbk_s_piadm5) gid=100(users) groups=100(users),1003(splunk)
[root@plvmcspldbconn0 ~]# usermod -aG s_patching cbk_s_piadm5
[root@plvmcspldbconn0 ~]# id cbk_s_piadm5
uid=9524(cbk_s_piadm5) gid=100(users) groups=100(users),1003(splunk),9753(s_patching)
[root@plvmcspldbconn0 ~]#
echo'user:passwd'| sudo chpasswd
================ bank user id creation on DEV LinuxServers=====
mkdir servers_list_SCTASK0026920_output;
File => servers_list_SCTASK0026920
[p021470a@ukirtbc100 ~]$ openssl passwd 1
uNZu9w04lUdgg
[p021470a@ukirtbc100 ~]$ openssl passwd -1
Password:
Verifying - Password:
$1$fgjZP5di$dlQn3fhiyaCh8/yopRwbr0
[p021470a@ukirtbc100 ~]$
cat >othercmd.sh<<EOF
useradd -g users -c "Reshma G" -p '$1$fgjZP5di$dlQn3fhiyaCh8/yopRwbr0' p021549a; chage
gpasswd -a p021549a s_webadmin;
gpasswd -a p021549a s_wasadm;
gpasswd -a p021549a s_dsadm;
gpasswd -a p021549a s_cmci;
gpasswd -a p021549a s_dsadm;
EOF
sudo pssh -i -h servers_list_SCTASK0026920 -o servers_list_SCTASK0026920_output -I < othe
e -d0 p021549a;
ercmd.sh
EOF
sudo pssh -i -h servers_list_SCTASK0026920 -o servers_list_SCTASK0026920_output -I < othe
for i in `cat servers_list_SCTASK0026920`;do ./check-port.pl $i 22;done
[p021470a@ukirtbc100 ~]$ cat check-port.pl
#!/usr/bin/perl -w
#
# returns 0 if host is listening on specified tcp port
#
use strict;
use Socket;
# set time until connection attempt times out
my $timeout = 3;
if ($#ARGV != 1) {
print "usage: open_port_check hostname portnumber\n";
exit 2;
}
my $hostname = $ARGV[0];
my $portnumber = $ARGV[1];
my $host = shift || $hostname;
my $port = shift || $portnumber;
my $proto = getprotobyname('tcp');
my $iaddr = inet_aton($host);
my $paddr = sockaddr_in($port, $iaddr);
socket(SOCKET, PF_INET, SOCK_STREAM, $proto) || die "socket: $!";
eval {
local $SIG{ALRM} = sub { die "timeout" };
alarm($timeout);
connect(SOCKET, $paddr) || error();
alarm(0);
};
if ($@) {
close SOCKET || die "close: $!";
print "$hostname is NOT listening on tcp port $portnumber.\n";
exit 1;
ercmd.sh
};
if ($@) {
close SOCKET || die "close: $!";
print "$hostname is NOT listening on tcp port $portnumber.\n";
exit 1;
}
else {
close SOCKET || die "close: $!";
print "$hostname is listening on tcp port $portnumber.\n";
exit 0;
}