回顾补充:
chmod 777 文件名
-rw-r--r-- 1 bu users 2254 2006-05-20 13:47 tt.htm
从第二个字符起rw-是说用户bu有读、写权,没有运行权,接着的r--表示用户组users只有读权限,没有运行权,最后的r--指其他人(others)只有读权限,没有写权和运行权。这是系统默认设置,我可以改写tt.htm,同组的人和其他人只有权读,没人有权运行,因为只是一个html文件,不必运行。这在Novell的directory services之前很先进。
读、写、运行三项权限可以用数字表示,就是r=4,w=2,x=1。所以,上面的例子中的rw-r--r--用数字表示成644。
反过来说777就是rwxrwxrwx,意思是该登录用户(可以用命令id查看)、他所在的组和其他人都有最高权限。
再多说一句。我用chmod o-r tt.htm命令改权限,o-r是others的权限中减掉读。结果是
-rw-r----- 1 bu users 2254 2006-05-20 13:47 tt.htm
如果用命令chmod 777 tt.htm,结果是
-rwxrwxrwx 1 bu users 2254 2006-05-20 13:47 tt.htm
任何人都有读、写、运行三项权限。
0809学习
nodejs服务器的创建(nodejs更底层,底层环境手动搭建,方便深入理解)
const http =require('http');//加载http模块
const ip ='192.168.136.129';//定义常量IP
const port =3000;//定义端口号
http.creatServer((req,res) => {
res.writeHead(200,{'Content-Type':'text/html'});
res.write('hello');
res.end()
}).listen(port,ip,() =>{
console.log('server start');
});
http.creatServer()内放的是一个回调函数,(req,res)回调函数的参数,
{
res.writeHead(200,{'Content-Type':'text/html'});
res.write('hello');
res.end()
}为回调函数的功能体部分
抽象方法和获取部分块的内容URL
const http =require('http');//加载http模块
const ip ='192.168.136.129';//定义常量IP
const port =3000;//定义端口号
const url =require('url');
//创建回到函数
var f1=function (req,res){
//获取URL地址块的内容
var parth =url.parse(req,url).pathname;
res.write(parth);
res.end();
}
//监听端口的回调函数
var f2=function(){
console.log("server start! xg")
}
http.createServer(f1).listen(port ip,f2)
回来继续补充。
网友评论