• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!

Linux Stupid locked www folder? (Permission Denied)

Joriku

Working in the mines, need something?
Joined
Jul 16, 2016
Messages
1,088
Solutions
15
Reaction score
381
Location
Sweden
YouTube
Joriku
Hi,
I know this sounds stupid but.. (sudo cd) does not work either. normal cd shows that It's not permitted.
5e1e02e23a67cd0d2d0f30bdf79415bd.png

45205bd9bb71e39c6d6a684ee917dac0.png


WinSCP view
166d7b62552318bd1fbeadb0a9caae73.png


What I did before this:
Lua:
chown -R www-data:www-data /var/www
chmod -R 755 /var/www/html

Any Ideas of what Might have happend?
Also:
Someone told me to put,
reason:
Lua:
chmod -R 750 /var/www
 
Hi,
I know this sounds stupid but.. (sudo cd) does not work either. normal cd shows that It's not permitted.
5e1e02e23a67cd0d2d0f30bdf79415bd.png

45205bd9bb71e39c6d6a684ee917dac0.png


WinSCP view
166d7b62552318bd1fbeadb0a9caae73.png


What I did before this:
Lua:
chown -R www-data:www-data /var/www
chmod -R 755 /var/www/html

Any Ideas of what Might have happend?
Also:
Someone told me to put,
reason:
Lua:
chmod -R 750 /var/www
lol, you dont have root permission.

if you switch to root (superuser), you can access any unix directory.

execute this:
Code:
sudo su
cd /var/www

if you need edit root password:
Code:
sudo passwd root

and set the new password for root.
 
lol, you dont have root permission.

if you switch to root (superuser), you can access any unix directory.

execute this:
Code:
sudo su
cd /var/www

if you need edit root password:
Code:
sudo passwd root

and set the new password for root.
Thing Is, the user Is set to root.
And I don't want to use the root user, I disabled it
 
Thing Is, the user Is set to root.
And I don't want to use the root user, I disabled it

I don't know what reasons made you disable the root user. However, without having the necessary privileges, you will not be able to have complete access to all your directories and system. Permissions are a fundamental part of linux. Without them, we are unable to view, change or execute files, enter directories or list their contents.

If you do not want to continue using the root user, give the necessary privileges to the new user you have created.
 
I don't know what reasons made you disable the root user. However, without having the necessary privileges, you will not be able to have complete access to all your directories and system. Permissions are a fundamental part of linux. Without them, we are unable to view, change or execute files, enter directories or list their contents.

If you do not want to continue using the root user, give the necessary privileges to the new user you have created.
This I know already, the reason for me to lock It Is sort of to secure myself. I use a super user Instead for sort of everything.
How would I give perms?
This Is what I used to give myself permissions.
Lua:
sudo usermod -aG sudo username
 
This I know already, the reason for me to lock It Is sort of to secure myself. I use a super user Instead for sort of everything.
How would I give perms?
This Is what I used to give myself permissions.
Lua:
sudo usermod -aG sudo username
I don't know what your current O.S, however it is basically this:

go to /etc/sudoers, you can use nano /etc/sudoers

find this line
Code:
root    ALL=(ALL:ALL) ALL
then paste below
Code:
YOURNEWUSERCREATED    ALL=(ALL:ALL) ALL

and restart your machine.
 
I don't know what your current O.S, however it is basically this:

go to /etc/sudoers, you can use nano /etc/sudoers

find this line
Code:
root    ALL=(ALL:ALL) ALL
then paste below
Code:
YOURNEWUSERCREATED    ALL=(ALL:ALL) ALL

and restart your machine.
Isn't this basiclly like adding a root user?
Not a super user?
I have access to the root user, so commands will do just fine ^^
 
Isn't this basiclly like adding a root user?
Not a super user?
I have access to the root user, so commands will do just fine ^^
Yes. You will be giving the necessary permissions for your user to access the directories (/var/www).

No security measure that i know of justifies excluding the "root" user entirely. You don't want to use "ROOT" by default is ok, but if you create a new user called "KloneraAdminAbcd" for example, the probability that someone will guess the new superuser name and still set your correct password or private key is practically nil..

Now, if you want to use MyAcc without giving your user any permission, unfortunately i can't help you. I don't know how to do this by this way.

Att!
 
Changing permissions on main folders like var, etc, and those can cause major problems in your linux server.

The best way would be running the website from your root user and the server from your new user. Then you can keep all server files in your documents file and that can have its permissions changed with no problems.

Otherwise you can create a www folder inside your documents and set up the website to use that. You can just google how to do that.
 
I don't know what reasons made you disable the root user. However, without having the necessary privileges, you will not be able to have complete access to all your directories and system. Permissions are a fundamental part of linux. Without them, we are unable to view, change or execute files, enter directories or list their contents.

If you do not want to continue using the root user, give the necessary privileges to the new user you have created.
Disabling the root user, or actually the root login, is a default precaution on Linux systems. However adding a new sudo user first is essential of course, but from what I understood, he did that.

Yes. You will be giving the necessary permissions for your user to access the directories (/var/www).

No security measure that i know of justifies excluding the "root" user entirely. You don't want to use "ROOT" by default is ok, but if you create a new user called "KloneraAdminAbcd" for example, the probability that someone will guess the new superuser name and still set your correct password or private key is practically nil..

Now, if you want to use MyAcc without giving your user any permission, unfortunately i can't help you. I don't know how to do this by this way.

Att!
There is no reason to add a new root user, then might as well enable the actual one again.
What @Klonera did with adding his user as sudo is the right way to go.

Changing permissions on main folders like var, etc, and those can cause major problems in your linux server.

The best way would be running the website from your root user and the server from your new user. Then you can keep all server files in your documents file and that can have its permissions changed with no problems.

Otherwise you can create a www folder inside your documents and set up the website to use that. You can just google how to do that.
Yes to the first sentence. But you should never run a website from a root user.
The webserver is run by root by default yes, but the workers are always spawned using the www-data (or sometimes nginx) user.


Now to actually solving your problem.
When working and having to use sudo permissions a lot, I can recommend you use sudo -i which gives you infinite sudo privileges until you exit
sudo cd actually doesn't exist and will never work by the way. It's a combination of commands that is just not possible.
Permissions don't change themselves though. And it seems like the permissions of /var/www aren't enough for your normal user "joeru" to read or cd into them. So you would need to change the read permissions on /var/www and not just it's subfolders.
 
Last edited:
Back
Top