Monthly Archives: April 2018

How to add sudo user on CentOS 7

Scenario: add sudo user on CentOS 7
System: CentOS 7

Steps to Create a New Sudo User
– Log in to your server as the root user.
– Use the adduser command to add a new user to your system,example add user with username bachem.

[root@horse ~]# useradd bachem
[root@horse ~]# passwd bachem
Changing password for user bachem.
New password:
Retype new password:
passwd: all authentication tokens updated successfully.
[root@horse ~]#

Continue reading

Limit memory usage per user on CentOS/RHEL

Scenario: How to limit memory usage per user on CentOS/RHEL
System: CentOS/RHEL 6/7

I would like to cap the amount of memory the users on a server can use. The applications developed by our users have memory leaks and I want to prevent them from using all the memory and crashing the system.

Resolution
It is possible to limit the amount of memory that each process can allocate with the RLIMIT facility in Red Hat Enterprise Linux. RLIMIT_AS limits the size of the virtual address space and it is a suitable solution in many cases which require limiting per-process memory consumption even though there are many limits related to memory.
Continue reading