apache 如何获得编辑文件 apache2.conf 的权限?[Ubuntu]
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/1640821/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
How to get permission to edit the file apache2.conf? [Ubuntu]
提问by rodrigo3n
I'm a beginner Ruby on Rails Programmer and I'm trying to install Apache2 + Passenger(That's for Rails Deployment).. and at the end of the installation process, Passenger gave me a few lines to add to the file apache2.conf at /etc/apache2/ but I can't override this file.. I have no permission =( I've also uploaded an imageshowing me the error.
我是一个初学者 Ruby on Rails 程序员,我正在尝试安装 Apache2 +Passenger(这是用于 Rails 部署)。在安装过程结束时,Passenger 给了我几行添加到文件 apache2.conf在 /etc/apache2/ 中,但我无法覆盖此文件。我没有权限 =( 我还上传了一张显示错误的图片。
P.S => I'm logged into Ubuntu with my username and password.
PS => 我用我的用户名和密码登录到 Ubuntu。
Please help! and thanks, Rodrigo.
请帮忙!谢谢,罗德里戈。
回答by Josh Lee
The simplest way is to open the file with the sudoeditprogram, as in
最简单的方法是用sudoedit程序打开文件,如
sudoedit /etc/apache2/apache2.conf
which will prompt for your password and then open your editor.
这将提示您输入密码,然后打开您的编辑器。
回答by Stef
After the installation has completed, add phpmyadmin to the apache configuration.
安装完成后,在apache配置中添加phpmyadmin。
sudo nano /etc/apache2/apache2.conf
Add the phpmyadmin config to the file. Include
将 phpmyadmin 配置添加到文件中。包括
/etc/phpmyadmin/apache.conf
Restart apache:
重启阿帕奇:
sudo service apache2 restart
回答by ronniedroid
I hope this will help someone considering the number of years since the last post. I tried this, and it worked for me.
我希望这会对考虑自上次发布以来的年数的人有所帮助。我试过这个,它对我有用。
sudo bash
Then the command to edit. Then save the file. Below is the site I got the procedure from.
然后命令编辑。然后保存文件。以下是我从中获得程序的站点。
回答by Dhivin
Enter the command:
输入命令:
sudo nano /etc/apache2.conf
须藤纳米 /etc/apache2.conf
回答by Newbie
Or you can use the following chmod 777 usr/local/apache2/conf/httpd.confthis will enable you to read/write the config file but be warned if you are planning on putting apache2 online you must revert it back to the old permissions chmod 640 usr/local/apache2/conf/httpd.conf
或者您可以使用以下内容,chmod 777 usr/local/apache2/conf/httpd.conf这将使您能够读/写配置文件,但如果您打算将 apache2 联机,请注意您必须将其恢复为旧权限chmod 640 usr/local/apache2/conf/httpd.conf
回答by Anton Balashov
If you are a beginner in GNU/Linux, I want to notice, for run command with root privileges run it with sudo:
如果您是 GNU/Linux 的初学者,我想注意,对于具有 root 权限的运行命令,请使用 sudo 运行它:
sudo <your_command>
If you want to get root privileges for current terminal session (no need to type sudo each command) run:
如果您想获得当前终端会话的 root 权限(无需在每个命令中键入 sudo),请运行:
sudo -i

