create account

Use su without the need of a password by timoschuetz

View this thread on: hive.blogpeakd.comecency.com
· @timoschuetz · (edited)
$0.45
Use su without the need of a password
I recently searched for a solution to su into a user which is only used for an application without entering a password. I normally create an application user without any password because that user never should be able to be logged on to.   If you are not using the root user or sudo to log on you are required to enter a password even though the user does not have one at all. I found a neat trick which I want to share with you. 
We can achieve these goals using Pluggable Authentication Modules or short PAM. We need to edit the corosponding su file with is located under `/etc/pam.d/su` and add the following lines under `pam_rootok.so`:
auth  [success=ignore default=1] pam_succeed_if.so user = user
auth  sufficient                 pam_succeed_if.so use_uid user = adminuser
If you want to allow a group of users to su into the user defined in the first line instead of one single user you can use
auth sufficient pam_succeed_if.so use_uid user ingroup admins
for the second line. In this example the group is called `admins`, the user which will su into another user `adminuser` and the user that will be su’ed in `user`
The finished file should now look like this:
```
#
# The PAM configuration file for the Shadow `su' service
#

# This allows root to su without passwords (normal operation)
auth       sufficient pam_rootok.so
auth  [success=ignore default=1] pam_succeed_if.so user = user
auth sufficient pam_succeed_if.so use_uid user ingroup admins
...
```
👍  , , , , , , , , , , , , , , , , , ,
properties (23)
authortimoschuetz
permlinkuse-su-without-the-need-of-a-password
categorylinux
json_metadata{"tags":["linux","server","authorization"],"app":"steemit/0.1","format":"markdown"}
created2019-09-13 09:20:30
last_update2019-09-13 09:21:21
depth0
children2
last_payout2019-09-20 09:20:30
cashout_time1969-12-31 23:59:59
total_payout_value0.228 HBD
curator_payout_value0.226 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length1,468
author_reputation38,710,934,222
root_title"Use su without the need of a password"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id90,533,142
net_rshares1,784,832,780,229
author_curate_reward""
vote details (19)
@steemitboard ·
Congratulations @timoschuetz! You have completed the following achievement on the Steem blockchain and have been rewarded with new badge(s) :

<table><tr><td><img src="https://steemitimages.com/60x60/http://steemitboard.com/img/notifications/firstvote.png"></td><td>You made your First Vote</td></tr>
<tr><td><img src="https://steemitimages.com/60x70/http://steemitboard.com/@timoschuetz/voted.png?201909131340"></td><td>You received more than 10 upvotes. Your next target is to reach 50 upvotes.</td></tr>
</table>

<sub>_You can view [your badges on your Steem Board](https://steemitboard.com/@timoschuetz) and compare to others on the [Steem Ranking](https://steemitboard.com/ranking/index.php?name=timoschuetz)_</sub>
<sub>_If you no longer want to receive notifications, reply to this comment with the word_ `STOP`</sub>



###### [Vote for @Steemitboard as a witness](https://v2.steemconnect.com/sign/account-witness-vote?witness=steemitboard&approve=1) to get one more award and increased upvotes!
properties (22)
authorsteemitboard
permlinksteemitboard-notify-timoschuetz-20190913t142632000z
categorylinux
json_metadata{"image":["https://steemitboard.com/img/notify.png"]}
created2019-09-13 14:26:33
last_update2019-09-13 14:26:33
depth1
children0
last_payout2019-09-20 14:26:33
cashout_time1969-12-31 23:59:59
total_payout_value0.000 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length1,004
author_reputation38,975,615,169,260
root_title"Use su without the need of a password"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id90,540,430
net_rshares0
@syntoxictech ·
Really cool, works perfectly in my environment!
👍  
properties (23)
authorsyntoxictech
permlinkpxru3a
categorylinux
json_metadata{"tags":["linux"],"app":"steemit/0.1"}
created2019-09-13 13:14:00
last_update2019-09-13 13:14:00
depth1
children0
last_payout2019-09-20 13:14:00
cashout_time1969-12-31 23:59:59
total_payout_value0.000 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length47
author_reputation3,575,525,740
root_title"Use su without the need of a password"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id90,538,259
net_rshares0
author_curate_reward""
vote details (1)