Proper way of creating users and restricting permissions?

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP








up vote
0
down vote

favorite












I want to create a user, allocate a home directory to the user and restrict their rwx permissions such that they can only stay/view the home directory. I want to hide /etc/apache2 and /var/www mainly.



I've tried:



useradd newuser
groupadd newgroup
usermod -g newgroup newuser
chmod g+rwx /home/newuser
chgrp -R /home/newuser


And it all seems well, but when I su newuser, I get bash: /etc/bash.bashrc: Permission denied, and it'd probably mean other applications probably will suffer also. So what is the proper way to achieve what I need?



Note: this is for a server, so no GUI and the newuser will require ssh access (at least).







share|improve this question




















  • Not really, I could setfacl -R -m u:newuser:--- /var/www for every directory that I want hidden. It's just not clean and not exactly future proof.
    – anonymous frog
    Apr 26 at 12:04










  • chgrp -R /home/newuser is missing the group argument. Depending on what the user should be able to do, they will need access to files outside of their home directory. But I don't understand how the commands you listed above would prevent the user from accessing /bin/bash or /etc/bash.bashrc, since both files (and their folders) should have appropriate read/execute permissions for others. Have you changed any file permissions except for /home/newuser?
    – danzel
    Apr 26 at 12:20










  • My point was, anyone with admin privileges can reverse setfacl or whatever you use to restrict access.
    – user68186
    Apr 26 at 13:56














up vote
0
down vote

favorite












I want to create a user, allocate a home directory to the user and restrict their rwx permissions such that they can only stay/view the home directory. I want to hide /etc/apache2 and /var/www mainly.



I've tried:



useradd newuser
groupadd newgroup
usermod -g newgroup newuser
chmod g+rwx /home/newuser
chgrp -R /home/newuser


And it all seems well, but when I su newuser, I get bash: /etc/bash.bashrc: Permission denied, and it'd probably mean other applications probably will suffer also. So what is the proper way to achieve what I need?



Note: this is for a server, so no GUI and the newuser will require ssh access (at least).







share|improve this question




















  • Not really, I could setfacl -R -m u:newuser:--- /var/www for every directory that I want hidden. It's just not clean and not exactly future proof.
    – anonymous frog
    Apr 26 at 12:04










  • chgrp -R /home/newuser is missing the group argument. Depending on what the user should be able to do, they will need access to files outside of their home directory. But I don't understand how the commands you listed above would prevent the user from accessing /bin/bash or /etc/bash.bashrc, since both files (and their folders) should have appropriate read/execute permissions for others. Have you changed any file permissions except for /home/newuser?
    – danzel
    Apr 26 at 12:20










  • My point was, anyone with admin privileges can reverse setfacl or whatever you use to restrict access.
    – user68186
    Apr 26 at 13:56












up vote
0
down vote

favorite









up vote
0
down vote

favorite











I want to create a user, allocate a home directory to the user and restrict their rwx permissions such that they can only stay/view the home directory. I want to hide /etc/apache2 and /var/www mainly.



I've tried:



useradd newuser
groupadd newgroup
usermod -g newgroup newuser
chmod g+rwx /home/newuser
chgrp -R /home/newuser


And it all seems well, but when I su newuser, I get bash: /etc/bash.bashrc: Permission denied, and it'd probably mean other applications probably will suffer also. So what is the proper way to achieve what I need?



Note: this is for a server, so no GUI and the newuser will require ssh access (at least).







share|improve this question












I want to create a user, allocate a home directory to the user and restrict their rwx permissions such that they can only stay/view the home directory. I want to hide /etc/apache2 and /var/www mainly.



I've tried:



useradd newuser
groupadd newgroup
usermod -g newgroup newuser
chmod g+rwx /home/newuser
chgrp -R /home/newuser


And it all seems well, but when I su newuser, I get bash: /etc/bash.bashrc: Permission denied, and it'd probably mean other applications probably will suffer also. So what is the proper way to achieve what I need?



Note: this is for a server, so no GUI and the newuser will require ssh access (at least).









share|improve this question











share|improve this question




share|improve this question










asked Apr 26 at 11:50









anonymous frog

1




1











  • Not really, I could setfacl -R -m u:newuser:--- /var/www for every directory that I want hidden. It's just not clean and not exactly future proof.
    – anonymous frog
    Apr 26 at 12:04










  • chgrp -R /home/newuser is missing the group argument. Depending on what the user should be able to do, they will need access to files outside of their home directory. But I don't understand how the commands you listed above would prevent the user from accessing /bin/bash or /etc/bash.bashrc, since both files (and their folders) should have appropriate read/execute permissions for others. Have you changed any file permissions except for /home/newuser?
    – danzel
    Apr 26 at 12:20










  • My point was, anyone with admin privileges can reverse setfacl or whatever you use to restrict access.
    – user68186
    Apr 26 at 13:56
















  • Not really, I could setfacl -R -m u:newuser:--- /var/www for every directory that I want hidden. It's just not clean and not exactly future proof.
    – anonymous frog
    Apr 26 at 12:04










  • chgrp -R /home/newuser is missing the group argument. Depending on what the user should be able to do, they will need access to files outside of their home directory. But I don't understand how the commands you listed above would prevent the user from accessing /bin/bash or /etc/bash.bashrc, since both files (and their folders) should have appropriate read/execute permissions for others. Have you changed any file permissions except for /home/newuser?
    – danzel
    Apr 26 at 12:20










  • My point was, anyone with admin privileges can reverse setfacl or whatever you use to restrict access.
    – user68186
    Apr 26 at 13:56















Not really, I could setfacl -R -m u:newuser:--- /var/www for every directory that I want hidden. It's just not clean and not exactly future proof.
– anonymous frog
Apr 26 at 12:04




Not really, I could setfacl -R -m u:newuser:--- /var/www for every directory that I want hidden. It's just not clean and not exactly future proof.
– anonymous frog
Apr 26 at 12:04












chgrp -R /home/newuser is missing the group argument. Depending on what the user should be able to do, they will need access to files outside of their home directory. But I don't understand how the commands you listed above would prevent the user from accessing /bin/bash or /etc/bash.bashrc, since both files (and their folders) should have appropriate read/execute permissions for others. Have you changed any file permissions except for /home/newuser?
– danzel
Apr 26 at 12:20




chgrp -R /home/newuser is missing the group argument. Depending on what the user should be able to do, they will need access to files outside of their home directory. But I don't understand how the commands you listed above would prevent the user from accessing /bin/bash or /etc/bash.bashrc, since both files (and their folders) should have appropriate read/execute permissions for others. Have you changed any file permissions except for /home/newuser?
– danzel
Apr 26 at 12:20












My point was, anyone with admin privileges can reverse setfacl or whatever you use to restrict access.
– user68186
Apr 26 at 13:56




My point was, anyone with admin privileges can reverse setfacl or whatever you use to restrict access.
– user68186
Apr 26 at 13:56















active

oldest

votes











Your Answer







StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "89"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);

else
createEditor();

);

function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
convertImagesToLinks: true,
noModals: false,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);



);













 

draft saved


draft discarded


















StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f1028383%2fproper-way-of-creating-users-and-restricting-permissions%23new-answer', 'question_page');

);

Post as a guest



































active

oldest

votes













active

oldest

votes









active

oldest

votes






active

oldest

votes















 

draft saved


draft discarded















































 


draft saved


draft discarded














StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f1028383%2fproper-way-of-creating-users-and-restricting-permissions%23new-answer', 'question_page');

);

Post as a guest













































































Popular posts from this blog

Which professions warranted travel in Medieval times?

How do so many people here on Academia.SE, and in general, afford lavish higher education programs?

Trouble downloading packages list due to a “Hash sum mismatch” error