Create LVM without partition table
![]() |
1.1 Scanning SCSI Host adapter |
![]() |
1.2 Create PV |
![]() |
1.3 Create VG |
![]() |
1.5 lsblk output |
Now you can create Filesystem to this Logical volume and mount it as per your requirement.
![]() |
1.6 XFS Format |
![]() |
1.1 Scanning SCSI Host adapter |
![]() |
1.2 Create PV |
![]() |
1.3 Create VG |
![]() |
1.5 lsblk output |
![]() |
1.6 XFS Format |
Technology growth is rapid, implementing solutions without proper restriction would cause data leak, cyberattacks. First line of defence for any solution would be its users. Granting granular privilege and role based access is one of the critical task that should be implemented.
SSH is Secure SHELL protocol works on port 22. In Linux, Users over remote connect to administer and manage daily activities on the server. There are multiple security ways of handling user access. In this blog I will be writing how we will restrict SSH access to server.
Create a Group in Linux that will contain all the users who will be provided SSH access to the server.
#groupadd ssh-users
You can also specify a group id for this group and maintain it across your environment to manage it with config automation tools like ansible and others in a large scale in future.
#groupadd -g 3000 ssh-users
Create user and add to the ssh-users group
# useradd -c "SSH Allowed user" -m -d /home/karthick -s /bin/bash -aG ssh-users karthick
where,
-c is comment for a administrator to identify what user or a brief about the user.
-d is mention home directory of the user
-s is login shell that the user will be using.
-a is to append user to the mentioned group
-G is to add user to the secondary groups mentioned.
SSH Restriction
Edit the sshd_config file under /etc/ssh/sshd and add the following line in the end.
AllowGroups ssh-users
Restart the sshd service.
#systemctl restart sshd
Now, ssh will be restricted to all users, except for those who are added in this ssh-users group.
Ansible Automation
I have written a sample ansible play to automate these tasks in my git - SSH-Restriction
Best Practices:
Never allow any Privileged/Admin accounts Remote SSH Access.
Always provide SSH access to normal user and then allow sudo escalation or su to privileged user with password.
References:
https://docs.ansible.com/ansible/latest/playbook_guide/playbooks_handlers.html
OS:
RHEL, SUSE Linux, Centos
Normal user in Linux can be allowed to execute privileged commands with sudo rights.
Sudoers configuration file is /etc/sudoers, however editing this file directly is not advisable either you can use visudo to edit this file or create a template file under /etc/sudoers.d.
I would suggest use template file under /etc/sudoers.d which will be more easier to manage multiple user privileges and it can me efficient in managing granular access.
Syntax - Who Where = (Runas-Who:group) What_Commands
Who - which user you want to give sudo rights/privilege.
where - In what server you want to grant the user access to execute mentioned commands.
Runas-Who:group - As which user will the user execute the granted commands.
What_commands - Finally the commands that you want to provide access to user for executing.
# visudo /etc/sudoers.d/shivadefaults !targetpwshiva ALL = (ALL:ALL) /usr/sbin/yum repolist
You can also enforce asking for root users password when elevating privilege.
"defaults targetpw"
Best practice:
Edit sudoers file with visudo which will validate the content when exiting and if anything wrong in the format it will show you error and you can edit the file to fix the issues.
While editing the sudoers template, ensure you have two session opened with root rights and let one session be running with TOP command. After implementing sudoers config make sure that sudo command is working without any problem on a new session and then you can terminate the top command and its session. It would be helpful if the sudoers went wrong and you are locked out of root.
This situation can occur when you have wrong sudo file and there is no root user login allowed directly.
To validate the sudoers configuration you created using visudo -vf %s if it is formatted correctly
By default when you Install Linux Operating system a user will be created and that user will have full sudo privilege. However when ever you create a user after installing OS, you will need to provision required privilege for that user. In this blog i will show you few commands with useradd and usermod.
The following user karthick has been created when OS was installed and this user is added to the Wheel group to get the sudo privilege. User karthick can run privileged commands with his password.
To create a normal user in command line providing the users home directory and UID we will use as -d to specify user home directory and -u for UID.
#useradd -d <Path_To_User's_HomeDirectory> -u UID
UID is a unique identifier number used to identify the user.
If you do not want user to have complete root access and instead provide granular or role based access we can provision that through sudo template. you can create a sudoers template/drop-in file under /etc/sudoers.d directory.
We will see about sudoers template file in much more detail in upcoming blogs.
zmprov commands are used for provisioning in zimbra.
syntax - zmprov command argument
gaà Get account – gets current value
maà Modify account – modifies current value to specified value.
gcfà get configuration – gets current configuration
mcfà modify configuration – Modifies current configuration to specified
configuration.
1. To Change display name for a single user
$zmprov ga user@domain.com | grep displayName
displayName: User Name
$zmprov ma user@domain.com displayName "User Name1"
$zmprov ga user@domain.com | grep displayName
displayName: User Name1
$zmprov ga user@domain.com | grep zimbraPrefFromDisplay
2. To Modify Mail attachment size
Check current value
zmprov gcf zimbraMtaMaxMessageSize
zmprov gcf zimbraFileUploadMaxSize
zmprov gcf zimbraMailContentMaxSize
Modify size
zmprov mcf zimbraMtaMaxMessageSize 20971520
zmprov mcf zimbraFileUploadMaxSize 20971520
zmprov mcf zimbraMailContentMaxSize 52428800
3. To get &Modify Mail forwarding
address.
zmprov ga user@domain.com zimbraPrefMailForwardingAddress
zmprov ma user@domain.com zimbraPrefMailForwardingAddressforward@domain.com