目录
- 1 查看用户
- 2 查看运行Apache Web Server的用户
- 3 .htaccess文件的路径?
- 4 Apache Directory的配置里面AllowOverride是做什么的?
- 5 Apache的error.log文件出现:(13)Permission denied: access to /index.php denied?
- 6 什么是SELinux,对通常的文件系统权限有什么影响?
- 7 查看Linux发行版和操作系统信息
- 8 使用yum查看某个软件包是否已经安装
- 9 vsftpd使用什么用户运行?
- 10 chroot list是干什么用的?
- 11 如何更改用户默认目录?
- 12 如何限制FTP用户访问其他目录?
- 13 如何查看用户属于哪个组?
- 14 新添加Linux用户有默认组吗?
- 15 如何把已有用户添加到一个新组?
- 16 如何查看CentOS使用的DNS服务器?
- 17 如何修改CentOS使用的DNS服务器?
- 18 如何查看本机IP地址?
- 19 系统审核日志的位置?
- 20 显示符号链接的源文件?
- 21 如何解压文件?
查看用户
cat /etc/passwd
查看运行Apache Web Server的用户
ps -ef | grep httpd
.htaccess文件的路径?
可以放在网站的目录下,比如wordpress的目录下。
参见:http://codex.wordpress.org.cn/Htaccess
Apache Directory的配置里面AllowOverride是做什么的?
Types of directives that are allowed in .htaccess files。
参见:http://httpd.apache.org/docs/current/zh-cn/mod/core.html#allowoverride
Apache的error.log文件出现:(13)Permission denied: access to /index.php denied?
Permission denied
error_log中的”Permission denied”错误伴随一个发送到客户端的”Forbidden”信息通常表明违反了文件系统的权限,而不是Apache HTTP的配置文件出了错误。检查并确认用于运行子进程的User和Group有访问导致问题的文件的足够权限。同时检查一下导致问题的文件所在的目录及其所有父目录是否具有执行(搜索)权限(也就是 chmod +x)。
最近发行的 Fedora Core 和其它Linux发行版使用了SELinux进行额外的访问控制,违反这些限制也会导致”Permission denied”消息。参见Fedora SELinux FAQ和Apache SELinux Policy Document以获得更多信息。
来自:http://apache.jz123.cn/faq/index.html
详解:http://wiki.apache.org/httpd/13PermissionDenied
什么是SELinux,对通常的文件系统权限有什么影响?
参考:Linux学习之CentOS(三十)–SELinux安全系统基础
导致出现(13)Permission denied的问题的确是SELinux,禁止的方法是:sudo setenforce 0
,然后wordpress就能正常访问了。
问题是这种方法,重启之后403禁止访问又出现了,治标不治本啊(只是在内存里面把SELinux关了)。方法:
使用chcon改变文件的上下文信息:
sudo chcon --reference=/var/www/html/ /srv/www/yourhostname.com/public_html/
然后使用restorecon恢复文件上下文(把目录下的所有文件递归改成和目录一样的上下文):
sudo restorecon -R -v /srv/www/yourhostname.com/public_html/
现在就能正常访问httpd了。
查看Linux发行版和操作系统信息
cat /etc/*-release
参见:http://www.cyberciti.biz/faq/find-linux-distribution-name-version-number/
使用yum查看某个软件包是否已经安装
使用yum list installed
可以查看所有已经安装在系统中的软件包,因此:
[tom@staging ~]$ yum list installed vsftpd
Failed to set locale, defaulting to C
Loaded plugins: fastestmirror, refresh-packagekit, security
Loading mirror speeds from cached hostfile
* base: mirror.esocc.com
* extras: mirror.esocc.com
* updates: mirrors.btte.net
Error: No matching Packages to list
[tom@staging ~]$ yum list installed httpd
Failed to set locale, defaulting to C
Loaded plugins: fastestmirror, refresh-packagekit, security
Loading mirror speeds from cached hostfile
* base: mirror.esocc.com
* extras: mirror.esocc.com
* updates: mirrors.btte.net
Installed Packages
httpd.x86_64 2.2.15-29.el6.centos @anaconda-CentOS-201311272149.x86_64/6.5
[tom@staging ~]$
可以使用 yum list installed vsftpd
查看是否已经安装了vsftpd,诸如此类。
参考:使用 Yum 搜索、罗列和显示软件包信息:http://lugir.com/story/124.html
vsftpd使用什么用户运行?
通过 ps -ef | grep vsftpd
查看是root用户。
chroot list是干什么用的?
TODO
如何更改用户默认目录?
TODO
如何限制FTP用户访问其他目录?
TODO
如何查看用户属于哪个组?
参考:
- http://www.cyberciti.biz/faq/linux-show-groups-for-user/
- http://www.centos.org/docs/5/html/Deployment_Guide-en-US/s1-users-tools.html
groups
groups userName-here
Example:
groups
groups root
输出:root : root
新添加Linux用户有默认组吗?
默认组名和用户名相同。
如何把已有用户添加到一个新组?
参见:http://www.cyberciti.biz/faq/howto-linux-add-user-to-group/
sudo usermod -a -G root wp_lehe
如何查看CentOS使用的DNS服务器?
参见:http://www.cyberciti.biz/faq/how-to-find-out-what-my-dns-servers-address-is/
cat /etc/resolv.conf
如何修改CentOS使用的DNS服务器?
修改/etc/resolv.conf
vim /etc/resolv.conf
如何查看本机IP地址?
当然是ifconfig了,筛选:
ifconfig | grep 192
系统审核日志的位置?
TODO
显示符号链接的源文件?
ls -al
就可以显示,如果是一个符号链接的话。如:
[root@tomcentos01 ~]# ls -al /etc/localtime
lrwxrwxrwx 1 root root 33 Apr 9 14:21 /etc/localtime -> /usr/share/zoneinfo/Asia/Shanghai
如何解压文件?
- tar.gz:
tar -zxvf source.tar.gz
- zip:
uzip ‘*.zip’ -d wp-themes
# 要用引号引起来 - bz2: TODO