- unixforum.org
- Решено: Permission denied под root’ом (очень непонятно)
- Решено: Permission denied под root’ом
- Re: Решено: Permission denied под root’ом
- Re: Решено: Permission denied под root’ом
- permission denied in linux when creating a new user [closed]
- 1 Answer 1
- ‘Permission Denied’ even while running as root
- 2 Answers 2
- Not the answer you’re looking for? Browse other questions tagged linux bash or ask your own question.
- Related
- Hot Network Questions
- Subscribe to RSS
- How to resolve permission denied Linux error
- What is permission denied Linux error?
- Example of Permission denied Linux error
- How to resolve Permission denied Error
- Resolving Permission denied error related to script execution:
- Resolving permission denied Linux error while listing or writing to a file
- Resolving permission denied Linux error for specific user
- Download Free book
- permission denied for root@localhost for ssh connection
- 6 Answers 6
unixforum.org
Форум для пользователей UNIX-подобных систем
- Темы без ответов
- Активные темы
- Поиск
- Статус форума
Решено: Permission denied под root’ом (очень непонятно)
Решено: Permission denied под root’ом
Сообщение routlaw » 16.06.2009 10:32
собсна, сабж.
захожу под рутом (без загрузки иксов ибо ставлю новые дрова от NVIDIA), запускаю файл с новыми дровами, а он мне Permission denied!!
самое интересное что в этой же папке запускаю файл со старыми дровами — и установка начинается!
убунту 904 гном. х86. ext4.
прошу помощи плиз.
Re: Решено: Permission denied под root’ом
Сообщение blackdevil » 16.06.2009 10:35
Как заходите? Куда заходите? Точно под рутом или через sudo? Как запускаете? Какие права на файл? Где точный вывод того что выводится в терминал?
В общем информации ноль. а ответ наверное надеетесь получить.
Re: Решено: Permission denied под root’ом
Сообщение Pravednik » 16.06.2009 10:35
собсна, сабж.
захожу под рутом (без загрузки иксов ибо ставлю новые дрова от NVIDIA), запускаю файл с новыми дровами, а он мне Permission denied!!
самое интересное что в этой же папке запускаю файл со старыми дровами — и установка начинается!
убунту 904 гном. х86. ext4.
прошу помощи плиз.
Файл нужно сделать исполняемым. Либо галочку в свойствах файла поставьте, либо chmod
Источник
permission denied in linux when creating a new user [closed]
Want to improve this question? Update the question so it’s on-topic for Stack Overflow.
Closed last year .
I am new in linux and I was trying to do some commands in terminal. My problem is that when I do su to another user, and I want to create a directory there, it shows me that permission is denied. Please, help me to understand why this happens and what can I do to solve it.
But if I type this:
user1 is not in suboers file.
1 Answer 1
So you have two issues here.
The first is that the new user you created cannot create a new dir. This is because, even though you’re changing users (user -> root -> user1), you’re still in the home directory of user , which user1 can’t write to. What you need to do is either specify a user directory when you create the user, ( useradd -d /home/user1 user1 ), as @fedorqui mentioned, or, if you’ve already created user1 , use the usermod command to add a home directory to user1 , like this:
If /home/user1 does not exist, you’ll need to, as root , do the following:
What this is doing is first creating the directory, and then assigning ownership of it to your newly created user. So now, when you do su — user1 , you’ll end up in /home/user1 . You should now be able to create directories and files.
Your second issue, «user1 is not in suboers file.» , is a result of how sudo manages which users are allowed to use it. The rules that control this are in /etc/sudoers , which you should edit with visudo . If you wanted to allow user1 to run whatever they want with sudo, you could add a line like this:
Which says that user user1 may run any command on the system as root. If you now try to run a command with sudo as user1 , it will prompt you for user1 ‘s password and then run the command.
Источник
‘Permission Denied’ even while running as root
I have a simple bash shell script:
when I run this script with sudo ./’script_name’ , I get a permission denied error on the line where I attempt to access /etc/passwd. What am I doing wrong here?
2 Answers 2
user_exists=$(cat /etc/passwd | grep ‘GNU Mailman’)
getent passwd username
To understand why, you have to look at the line the way that bash looks at the line:
According to bash, you are (temporarily) setting the environment variable user_exists to have the value cat . With that value set, then the program /etc/passwd is executed and its output sent to grep ‘GNU Mailman’ . Since /etc/passwd does not have execute permission, this command fails for lack of permission.
The solution is to use the proper format for process substitution as outlined by Vladimir Kolesnikov:
Not the answer you’re looking for? Browse other questions tagged linux bash or ask your own question.
Related
Hot Network Questions
Subscribe to RSS
To subscribe to this RSS feed, copy and paste this URL into your RSS reader.
site design / logo © 2021 Stack Exchange Inc; user contributions licensed under cc by-sa. rev 2021.10.8.40416
By clicking “Accept all cookies”, you agree Stack Exchange can store cookies on your device and disclose information in accordance with our Cookie Policy.
Источник
How to resolve permission denied Linux error
This article will teach you quickly what is permission denied Linux error. And also what ways you can avoid permission denied error in Linux.
What is permission denied Linux error?
This error comes when you try to list files or try execute the file inside the directory where you don’t have sufficient permission. Since Linux operating system is very particular about its security aspect.
Example of Permission denied Linux error
Let’s say you are a normal user who is trying to list or trying change the directory inside the /root file-system. Since you do not have sufficient permissions system will respond with permission denied error message as below:
One way to avoid such error is to switch to root user using su – command. However this solution is not recommended since it will gain unnecessary access to all the root file system.
How to resolve Permission denied Error
Resolving Permission denied error related to script execution:
Let’s say you have created a shell script for performing any task. but when you try to execute the script you may end with below error due absence of permission denied error.
Now to avoid such case you need to add execute permission “x” to the file myshell.sh using chmod command as below:
In the last output you can see that there is “x” (execution) permission added after chmod command. So next time when you try to execute the shell script , it will execute without any error.
Resolving permission denied Linux error while listing or writing to a file
In this type of permission denied error you try to list or write the file in which you do not have sufficient permission to do so as below:
If you look at the permissions of the “myfolder” directory using ls -l command you will come to know about the permissions.
As per the permission given in above output only owner of the directory who is root can have all permission that is read, write and execute. So in such case you need to change the permission of the directory to read using below chmod command:
Now this time when normal user manmohan try to list directory he will not get the permission denied error.
In case you want to have write permission on this directory you need to specify w flag as well in chmod command as below:
Same is applicable to file level permission as well.
One more way is to changing the ownership of the directory using chown command. Since in our example we are getting error for user manmohan we will change ownership of the directory “myfolder” using below command.
Since manmohan user is now the owner of the directory he can able to do any operation on the directory. In case you want to recursive permission do not forget to add -r while chown command as below:
Resolving permission denied Linux error for specific user
In above method of changing the permission using chmod is not suitable as per my opinion. Because when you give permission to others, it will be open for all the users within the system. Which is wrong in terms of security perspective. To resolve this error specific to user you can implement it using access control list or ACL. Follow my article on Access control list ACL for the same.
Download Free book
Get your free copy of Linux command line Cheat Sheet.
Источник
permission denied for root@localhost for ssh connection
I just installed Ubuntu 14.04 and LAMP on that. Then, I wanted to configure my server, so tried out This tutorial.
When I give the command:
I get : Permission denied, please try again. I have logged in as root user through the command :
I also tried the same, by logging in through:
I use the same password as that I used to log in as user, but still am getting the same error message.
Could someone help me out here?
PS: I looked into This question but didn’t seem to work for me.
6 Answers 6
By default, the SSH server denies password-based login for root. In /etc/ssh/sshd_config , if the following line exists, possibly commented out (with a # in front):
Then change it to the following, uncommenting if needed (remove the # in front):
And restart SSH:
Or, you can use SSH keys. If you don’t have one, create one using ssh-keygen (stick to the default for the key, and skip the password if you feel like it). Then do sudo -s (or whatever your preferred method of becoming root is), and add an SSH key to /root/.ssh/authorized_keys :
In some cases, after change,
must check this config:
and to enable login must change to:
If u have not given password for root and you are trying to fire command on spark or haddop like ./sbin/stop-all.sh or./sbin/start-all.sh . If you don’t have a root password, you can setup one using
and fire commands.
I had a similar problem to this. I needed two PCs, one on Ubuntu and another on Arch, to sync files through Unison but ran into the same permission denied error. Just for the sake of those who are having the same problem as I was, here’s what I did:
First: Installed the same version of Unison on both PCs. This was a bit challenging as the one available on the software center was behind to what was readily available for Arch. So, I couldn’t find a higher version for Ubuntu, so I replaced the one on Arch with a lower one instead. Found one here: http://zdia.de/downloads/unison-2.40.102-linux-x86_64. The same version is in the software center for Ubuntu.
I ran into a problem in step 3 as I tried to ssh-copy. But it was resolved by changing «id_dsa.pub» into «id_rsa.pub» in the «ssh-copy-id -i $HOME/.ssh/id_dsa.pub root@192.168.0.101» line. Probably my fault, as I think I forgot to add «-t dsa». Anyway, try the original command first. IF you get an error, then change to rsa.
After following the steps above, I found I still couldn’t get Unison to connect to the other server, neither can I log in (without Unison) through ssh to the other server. Finally,after hours of google searching, I was led to this page, and the answer given my Muru sealed the deal.
After applying it, I could now login via SSH to server 2.
So I ran Unison, and corrected the profile settings, and viola!
Источник