Add script for creating new linux users
This commit is contained in:
		
							parent
							
								
									61fc06e878
								
							
						
					
					
						commit
						712e64b96f
					
				
							
								
								
									
										16
									
								
								scripts/adduser.sh
									
									
									
									
									
										Executable file
									
								
							
							
						
						
									
										16
									
								
								scripts/adduser.sh
									
									
									
									
									
										Executable file
									
								
							@ -0,0 +1,16 @@
 | 
				
			|||||||
 | 
					#!/bin/bash
 | 
				
			||||||
 | 
					## Author: Shaun Reed | Contact: shaunrd0@gmail.com | URL: www.shaunreed.com ##
 | 
				
			||||||
 | 
					## A custom bash script for creating new linux users.                        ##
 | 
				
			||||||
 | 
					## Syntax: ./adduser.sh <username> <userID>                                  ##
 | 
				
			||||||
 | 
					###############################################################################
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					sudo adduser $1 --gecos "First Last,RoomNumber,WorkPhone,HomePhone" --disabled-password --uid $2
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					printf "\nEnter 1 to set a password for $1, any other value will exit with no password set\n"
 | 
				
			||||||
 | 
					read choice
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					if [ $choice -eq 1 ] ; then
 | 
				
			||||||
 | 
					printf "\nChanging password for $1...\n"
 | 
				
			||||||
 | 
					sudo passwd $1
 | 
				
			||||||
 | 
					fi
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user