1

Installed an application as root owner but not as non-root. why? Because we had to install this application in custom location(/app)

So, after installing an application(Syslog-NG), below are the files with current ownership:

# ls -l /app/syslog-ng/etc/syslog-ng.conf
-rw-r--r-- 1 root root 938 Aug 20 12:43 /app/syslog-ng/etc/syslog-ng.conf
# ls -l /app/syslog-ng/sbin/syslog-ng
-rwxr-xr-x 1 root root 39768 Aug 20 12:43 /app/syslog-ng/sbin/syslog-ng

Requirement is to have a new local user(non root) on this RHEL server,

# uname -a
Linux abc123.xy.ef.com 3.10.0-693.17.1.el7.x86_64 #1 SMP Sun Jan 14 10:36:03 EST 2018 x86_64 x86_64 x86_64 GNU/Linux

which can read/modify file(syslog-ng.conf) and execute file(syslog-ng)

Goal - Application should not need elevated privileges to run. This new username is suppose to belong to that application but not to any specific user. This new username cannot be in /etc/sudoers for elevated privilege. Every LDAP user(employee) logging into that machine will sudo to this new username, before working with that application.


1) Do I need to create a new group(say newgrp) with some permissions? Command syntax please..

If yes...

2) What is the command syntax to add new user to be part of that group? chgrp newgrp filename would suffice...

2

Simply create a new user and a new group:

sudo adduser foo

Then, change the group of the file:

sudo chgrp foo /app/syslog-ng/etc/syslog-ng.conf

And add the write permission:

sudo chmod 664 /app/syslog-ng/etc/syslog-ng.conf

Executing /app/syslog-ng/sbin/syslog-ng should, according to the permissions, be already possible for every user.

  • How to add new user into foo? – overexchange Aug 21 '18 at 14:57
  • @overexchange I used "foo" as an example. It's the name of the created user, aswell as the group. If you want to add an existing user to the group, do "adduser <username> foo" – Panki Aug 21 '18 at 15:03
  • Can I maintain one name for both username and groupname? – overexchange Aug 21 '18 at 15:07
  • I'm not sure I understand your question. Every user has its own group, named after the user. I suggest you read up on this topic:linuxacademy.com/howtoguides/posts/show/topic/… – Panki Aug 21 '18 at 15:08
  • This was nice article..for me.... as a newbie to user management & Linux admin stuff.... – overexchange Aug 22 '18 at 12:57

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.