[GH-ISSUE #241] Question: su: Permision denied #69

Closed
opened 2026-03-03 13:58:53 +03:00 by kerem · 1 comment
Owner

Originally created by @esnavarro on GitHub (Feb 16, 2023).
Original GitHub issue: https://github.com/konstruktoid/hardening/issues/241

Originally assigned to: @konstruktoid on GitHub.

Describe the bug
su: Permission denied

Expected behavior
should be able to switch to another user account

System (lsb_release -a):
Distributor ID: Ubuntu
Description: Ubuntu 22.04.1 LTS
Release: 22.04
Codename: jammy

Additional context
I decided to perform the automated security hardening for my ubuntu 22.04 server, after I run the script (ubuntu.sh) I encountered an unexpected error. When I tried to switch to another account using the "su -l username" command and input with the right password I received an error message su: Permission denied

Is there a way to revert back to its normal state(remove the hardening) using the script?

Thank you,

Originally created by @esnavarro on GitHub (Feb 16, 2023). Original GitHub issue: https://github.com/konstruktoid/hardening/issues/241 Originally assigned to: @konstruktoid on GitHub. **Describe the bug** **su: Permission denied** **Expected behavior** should be able to switch to another user account **System (lsb_release -a):** Distributor ID: Ubuntu Description: Ubuntu 22.04.1 LTS Release: 22.04 Codename: jammy **Additional context** I decided to perform the automated security hardening for my ubuntu 22.04 server, after I run the script (**ubuntu.sh**) I encountered an unexpected error. When I tried to switch to another account using the "**su -l _username_**" command and input with the right password I received an error message **su: Permission denied** Is there a way to revert back to its normal state(remove the hardening) using the script? Thank you,
kerem closed this issue 2026-03-03 13:58:53 +03:00
Author
Owner

@konstruktoid commented on GitHub (Feb 16, 2023):

Hi @esnavarro, the restriction is set by https://github.com/konstruktoid/hardening/blob/master/scripts/rootaccess#L30.
I recommend you to use sudo -i -u username instead since su has been superseded by sudo, which allows for better control regarding privileged access.

<!-- gh-comment-id:1432830844 --> @konstruktoid commented on GitHub (Feb 16, 2023): Hi @esnavarro, the restriction is set by https://github.com/konstruktoid/hardening/blob/master/scripts/rootaccess#L30. I recommend you to use `sudo -i -u username` instead since `su` has been superseded by sudo, which allows for better control regarding privileged access.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/hardening#69
No description provided.