u
This commit is contained in:
		
							parent
							
								
									cab00d1a94
								
							
						
					
					
						commit
						e0f90ab6b4
					
				
							
								
								
									
										10
									
								
								exec-add-rsapub-to-remote.sh
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										10
									
								
								exec-add-rsapub-to-remote.sh
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,10 @@ | |||||||
|  | if [ $1 ] | ||||||
|  | then | ||||||
|  |   REMOTEHOST=$1 | ||||||
|  | else | ||||||
|  |   read -p "Enter user@remotehost " REMOTEHOST | ||||||
|  | fi | ||||||
|  | 
 | ||||||
|  | scp ~/.ssh/id_rsa.pub $REMOTEHOST:~/tmp.pub | ||||||
|  | 
 | ||||||
|  | ssh $REMOTEHOST "mkdir -p ~/.ssh && chmod 700 ~/.ssh && cat ~/tmp.pub >> ~/.ssh/authorized_keys && chmod 600 ~/.ssh/authorized_keys && rm -f ~/tmp.pub" | ||||||
| @ -1,5 +1,13 @@ | |||||||
| #!/bin/bash | #!/bin/bash | ||||||
| 
 | 
 | ||||||
|  | if [ $1 ] | ||||||
|  | then | ||||||
|  |   FONPATH=$1 | ||||||
|  | else | ||||||
|  |   read -p "Enter path-to-faronear " FONPATH | ||||||
|  | fi | ||||||
|  | 
 | ||||||
|  | pushd $FONPATH | ||||||
| for org in `ls .` | for org in `ls .` | ||||||
| do  | do  | ||||||
|   if [ -d $org ] |   if [ -d $org ] | ||||||
| @ -18,3 +26,4 @@ do | |||||||
|       cd ..; |       cd ..; | ||||||
|   fi |   fi | ||||||
| done | done | ||||||
|  | popd | ||||||
| @ -1 +1,15 @@ | |||||||
| rsync -rvz -e ssh -p 22000 --progress ./git.repo adot@west-cn.yuanjin.net:/home/adot/ | if [ $1 ] | ||||||
|  | then | ||||||
|  |   LOCALPATH=$1 | ||||||
|  | else | ||||||
|  |   read -p "Enter localpath " LOCALPATH | ||||||
|  | fi | ||||||
|  | 
 | ||||||
|  | if [ $2 ] | ||||||
|  | then | ||||||
|  |   REMOTEPATH=$2 | ||||||
|  | else | ||||||
|  |   read -p "Enter user@remotehost:path " REMOTEPATH | ||||||
|  | fi | ||||||
|  | 
 | ||||||
|  | echo rsync -rvz -e ssh -p 22000 --progress $LOCALPATH $REMOTEHOST | ||||||
|  | |||||||
| @ -44,6 +44,7 @@ useradd $User | |||||||
| passwd $User | passwd $User | ||||||
| mkdir /home/$User | mkdir /home/$User | ||||||
| chown $User:$User /home/$User | chown $User:$User /home/$User | ||||||
|  | chmod 700 /home/$User | ||||||
| # emacs /etc/passwd | # emacs /etc/passwd | ||||||
| # Debian 10 default to /bin/sh | # Debian 10 default to /bin/sh | ||||||
| sed -i "s/\/home\/$User:\/bin\/sh$/\/home\/$User:\/bin\/bash/g" /etc/passwd | sed -i "s/\/home\/$User:\/bin\/sh$/\/home\/$User:\/bin\/bash/g" /etc/passwd | ||||||
|  | |||||||
		Loading…
	
		Reference in New Issue
	
	Block a user