# - - # # - Create & delete users Ubuntu - # https://www.maketecheasier.com/add-remove-user-to-groups-in-ubuntu/ https://askubuntu.com/questions/80115/how-to-remove-a-user-from-a-group # - - # # - How to give root access to a normal user for a few commands only - # http://linuxg.net/how-to-allow-a-normal-user-to-run-some-root-commands/ :Step 1 # - - # # - Install samba server & create samba user - # :a # - - # # - Install samba server - # sudo apt install tasksel -y; sudo tasksel install samba-server; :b # - - # # - Terminal: Create samba user - # # - Create user without home and with no shell to login - # # - (user won't appear in login user list when linux starts) - # # - Use just one command, the second is the same without --uid - # sudo adduser smbguest --uid 992 --shell=/bin/false --no-create-home; Go to :Step 2 # - - # # - Create group - # https://www.techonthenet.com/linux/sysadmin/ubuntu/create_group_14_04.php sudo groupadd -g 27 sambashare; sudo groupadd -g 10000 students; sudo groupadd -g 10100 developers; # - - # # - Create a common user - # sudo adduser croman; # - Add user to sudo group - # sudo usermod -aG sudo croman; # - Delete user from sudo group - # sudo deluser croman sudo # - Change password to user - # sudo passwd croman; c1386 sudo adduser mariojose --shell=/bin/false --no-create-home; # - Don't use unless you need to delete an user - # # - Delete user and all his home directory & files - # sudo deluser --remove-home --remove-all-files mariojose; sudo deluser --remove-home --remove-all-files smbguest; # - - # # - Delete an user from a group - # sudo deluser username group sudo deluser croman sudo ? -> To test usermod -R "group" "user name" :Step 2 # - - # # - Add samba user to sambashare group - # sudo usermod -a -G sambashare smbguest; sudo usermod -a -G sambashare is_derayo; :Step 3 # - - # # - Create a samba & admin password - # sudo smbpasswd -a smbguest; sudo smbpasswd -a is_derayo; :Step 4 # - - # # - Enable samba & admin user - # sudo smbpasswd -e smbguest; sudo smbpasswd -e is_derayo; :Step 5 # - - # # - Check samba & admin user group - # cat /etc/group; tail /etc/group; cat /etc/group | grep smbguest; cat /etc/group | grep is_derayo; :Step 6 # - - # # - Check samba & admin on password file - # cat /etc/passwd; tail /etc/passwd; cat /etc/passwd | grep smbguest; cat /etc/passwd | grep is_derayo; :Step 7 # - - # # - Modify samba configuration file - # # - For full linux instalation in terminal - # sudo gedit /etc/samba/smb.conf # - For sever's terminal - # sudo vim /etc/samba/smb.conf workgroup = L_IS wins support = yes name resolve order = lmhosts host wins bcast # - For full linux installation only - # # - Please don't use this line in a dedicated server - # # - If this line does not appear in /etc/samba/smb.conf file, add it in Misc paragraph - # ############ Misc ############ security = user # - These lines go at the end of the /etc/samba/smb.conf file - # [ToShare-FullAccess] comment = ToShare-FullAccess to everybody in the net path = /home/Data/Documents/ToShare-FullAccess writeable = yes browseable = yes guest ok = no create mask = 0777 valid users = is_derayo, smbguest [ToShare-JustRead] comment = ToShare-JustRead to everybody in the net path = /home/Data/Documents/ToShare-JustRead writeable = no browseable = yes guest ok = no create mask = 0755 valid users = is_derayo, smbguest :Step 8 # - - # # - Restart samba service - # sudo systemctl enable smbd.service nmbd.service; sudo systemctl start smbd.service nmbd.service; sudo systemctl restart smbd.service nmbd.service; #sudo /etc/init.d/nmbd restart #sudo /etc/init.d/smbd restart :Step 9 # - - # # - End - # This process has ended here, please don't continue with the rest of it. service --status-all systemctl status smbd systemctl status nmbd sudo /etc/init.d/smbd stop sudo /etc/init.d/smbd start sudo service smbd stop sudo service smbd start sudo service nmbd restart sudo service smbd restart # - - # # - Sometimes you have to restart the computer - # # - - # # - This process ends right here - # # - - # # - - # # - Check samba connections - # sudo smbstatus # - - # # - Additional ways to create samba users - # 9. Create a samba user in server's terminal with no login options # - - # # - This procedure works beautiful in server's terminal - # # - already tested - # # - - # sudo useradd -u 990 josue -s /usr/sbin/nologin; sudo usermod -a -G sambashare josue; sudo smbpasswd -a josue; sudo smbpasswd -e josue; sudo useradd mario -s /usr/sbin/nologin; sudo usermod -a -G sambashare mario; sudo smbpasswd -a mario; sudo smbpasswd -e mario; # - - # # - id sambashare group - # getent group sambashare; # - Results - # sambashare:x:115:is_derayo,smbguest,sidneyjason # - Create samba user with 115 sambashare group at once, since we know sambashare ID group - # sudo useradd -u 989 -g 115 quique -s /usr/sbin/nologin; sudo smbpasswd -a quique; sudo smbpasswd -e quique; # - - # # - Jump to step 7 with smb.conf file - # # - - # # - In full installed linux terminal - # sudo gedit /etc/samba/smb.conf # - In server's terminal - # sudo vim /etc/samba/smb.conf sudo /etc/init.d/samba restart; # - - # # - Other commands - # # - - # # - Change user ID - # id mariofuentes; uid=996(mariofuentes) gid=130(sambashare) groups=130(sambashare) sudo usermod -u 1010 mariofuentes; [sudo] password for is_derayo: id mariofuentes; uid=1010(mariofuentes) gid=130(sambashare) groups=130(sambashare) # - - # # - Create a group - # sudo groupadd -g Group_ID Group_Name sudo groupadd -g 10000 students sudo groupadd -g 1020 administrators # - - # # - List all Unix group names? - # groups id -Gn # - Returns the list of groups for the specified user - # id -Gn mario # - List all groups names - All - # cut -d: -f1 /etc/group # - List all groups names - The best way - # getent group # - Check that the group called students was added to the system - # sudo tail /etc/group; tail /etc/group; cat /etc/group; cat /etc/group | grep is_derayo; cat /etc/passwd; tail /etc/passwd; cat /etc/passwd | grep is_derayo; # - Add user to the new group - # sudo usermod -a -G students mariojose; sudo usermod -a -G administrators mario; sudo usermod -a -G administrators mariofuentes; sudo usermod -a -G administrators is_derayo; sudo chown is_derayo:administrators 1-Linux_Configuration_Files/ # - - # # - id sambashare group - # getent group sambashare;