Chinaunix

标题: path设置 [打印本页]

作者: initialization    时间: 2007-06-22 17:08
标题: path设置
刚弄明白set和setenv的区别
看了看我的主目录下的.cshrc ,发现大部分变量都是setenv设置的,只有path是set设置的

忽然产生一个想法:
如果我把path的值清空,然后保存文件,那么是不是我什么程序都执行不了了呢(包括ls,vi 等等)?
如果为了把思想贯彻到底,我跟着修改/etc/.profile里的path ,是不是就真的全完全了?


ps:还好,/etc/.profile这个文件偶没操作权限,阻止了俺罪恶的黑手......
作者: waker    时间: 2007-06-22 17:15
只要你指出一个命令的正确位置,比如 /bin/ls, 它一样会运行,内部命令也不受PATH的影响
作者: r2007    时间: 2007-06-22 18:28
不要忽略了path的重要性,假如root或其他重要user的path最前面加入了一个普通用户可以写入的目录就非常危险了。ls find grep等命令都可能被劫持。
作者: initialization    时间: 2007-06-22 19:08
不要忽略了path的重要性,假如root或其他重要user的path最前面加入了一个普通用户可以写入的目录就非常危险了。ls find grep等命令都可能被劫持。


root操作普通用户可以写的目录中的文件或程序会有危险么?
是不是指那个用户建立了ls find grep 之类的同名恶意程序,那么root用户执行ls等内部命令的时候会先去执行它们?
作者: r2007    时间: 2007-06-22 19:49
The command path for the root user is very important. The command path (that is, the PATH environment variable) specifies the directories in which the shell searches for programs. Try to limit the command path for the root user as much as possible, and never include . (which means "the current directory") in your PATH. Additionally, never have writable directories in your search path, as this can allow attackers to modify or place new binaries in your search path, allowing them to run as root the next time you run that command.

http://www.scrye.com/~kevin/lsh/april-99/Security-HOWTO-4.html




欢迎光临 Chinaunix (http://bbs.chinaunix.net/) Powered by Discuz! X3.2