beam trawling

1.extracting user account data from  source server :

awk  -F:  ‘($3>=uid) &&($3!=max_uid_number)’  /etc/passwd   >  out.file

e.g.

awk  -F: ‘($3>=500) &&($3!=65534)’ /etc/passwd > password.txt

2.extracting group data from source server:

awk  -F:  ‘($3>=gid) &&($3!=max_gid_number)’  /etc/group   >  out.file

e.g.

awk  -F: ‘($3>=500) &&($3!=65534)’ /etc/group > group.txt

3.extracting user shadow data from source server:

awk -F: ‘($3>=uid) && ($3!=65534) {print $1}’ /etc/passwd | tee – | egrep -f – /etc/shadow > out.file

e.g.

awk -F: ‘($3>=500) && ($3!=65534) {print $1}’ /etc/passwd | tee – | egrep -f – /etc/shadow > shadow.txt

4. copy above files to destination server:

scp password.txt group.txt shadow.txt root@destination_server:~/

5.backup needed files for destination server:

cp  /etc/passwd passwd-backup

cp /etc/group group-backup

cp /etc/shadow shadow-backup

6.merging user and group metadata on destination server:

cat passwd.txt >> /etc/passwd

cat group.txt >> /etc/group

cat shadow.txt >> /etc/shadow

7.sync user home data to destination server(on source server):

scp -rp /home/$USER   dest ip or hostname:/home/

e.g.

scp -rp /home/testuser 110.120.193.6:/home/

8.to reboot destination server.

init 6  or reboot -f or shutdown -h -r

 

how to enable ssh service for root on kali

1、编辑/etc/ssh/sshd_config

将#PasswordAuthentication no 该行前面的#去掉,并且将NO修改为YES;

将#PermitRootLogin  without-password 该行前面的#去掉,并且将“without-password”修改为YES;

2、在root用户下执行以下两个命令

#ssh-keygen -t dsa -f /etc/ssh/ssh_host_dsa_key

#ssh-keygen -t dsa -f /etc/ssh/ssh_host_rsa_key

3、执行以后命令进行开始和关闭

update-rc.d ssh enable  /系统自动启动SSH服务

update-rc.d ssh disabled / 关闭系统自动启动SSH服务

Hello world!

Welcome to WordPress. This is your first post. Edit or delete it, then start writing!