Linux *** 作系统下Sudo命令的使用方法?

Linux *** 作系统下Sudo命令的使用方法?,第1张

名称:sudo

使用权限:在 /etc/sudoers 中有出现的使用者

使用方式:sudo -V

sudo -h

sudo -l

sudo -v

sudo -k

sudo -s

sudo -H

sudo [ -b ] [ -p prompt ] [ -u username/#uid] -s

sudo command

说明:以系统管理者的身份执行指令,也就是说,经由 sudo 所执行的指令就好像是 root 亲自执行

参数:

-V 显示版本编号

-h 会显示版本编号及指令的使用方式说明

-l 显示出自己(执行 sudo 的使用者)的权限

-v 因为 sudo 在第一次执行时或是在 N 分钟内没有执行(N 预设为五)会问密码,这个参数是重新做一次确认,如果超过 N 分钟,也会问密码

-k 将会强迫使用者在下一次执行 sudo 时问密码(不论有没有超过 N 分钟)

-b 将要执行的指令放在背景执行

-p prompt 可以更改问密码的提示语,其中 %u 会代换为使用者的帐号名称, %h 会显示主机名称

-u username/#uid 不加此参数,代表要以 root 的身份执行指令,而加了此参数,可以以 username 的身份执行指令(#uid 为该 username 的使用者号码)

-s 执行环境变数中的 SHELL 所指定的 shell ,或是 /etc/passwd 里所指定的 shell

-H 将环境变数中的 HOME (家目录)指定为要变更身份的使用者家目录(如不加 -u 参数就是系统管理者 root )

command 要以系统管理者身份(或以 -u 更改为其他人)执行的指令

范例:

sudo -l 列出目前的权限

sudo -V 列出 sudo 的版本资讯

在Linux系统中进行FastDFS软件的安装配置,方法的过程中是很复杂的,所以如果不是专业的电脑高手可能是没有办法整理出来,所以为了方便网友们更好的了解这个软件的安装,一下就是详细的过程,大家一起来看看吧!\x0d\x0a第一步:安装FastDFS\x0d\x0a1.解压FastDFS_v4.07.tar.gz==>FastDFS\x0d\x0a2.cdFastDFS==>vimmake.sh\x0d\x0a修改以下内容\x0d\x0aTARGET_PREFIX=/usr/local/fdfs\x0d\x0aTARGET_CONF_PATH=/usr/local/fdfs/conf\x0d\x0amkdir-p/usr/local/fdfs\x0d\x0amkdir-p/usr/local/fdfs/conf\x0d\x0a修改\x0d\x0aif["$uname"="Linux"]then\x0d\x0aif["$WITH_LINUX_SERVICE"="1"]then\x0d\x0aif[!-d$TARGET_CONF_PATH]then\x0d\x0amkdir-p$TARGET_CONF_PATH\x0d\x0acp-fconf/tracker.conf$TARGET_CONF_PATH\x0d\x0acp-fconf/storage.conf$TARGET_CONF_PATH\x0d\x0acp-fconf/client.conf$TARGET_CONF_PATH\x0d\x0acp-fconf/http.conf$TARGET_CONF_PATH\x0d\x0acp-fconf/mime.types$TARGET_CONF_PATH\x0d\x0afi\x0d\x0acp-finit.d/fdfs_trackerd/etc/rc.d/init.d/\x0d\x0acp-finit.d/fdfs_storaged/etc/rc.d/init.d/\x0d\x0a/sbin/chkconfig--addfdfs_trackerd\x0d\x0a/sbin/chkconfig--addfdfs_storaged\x0d\x0afi\x0d\x0afi\x0d\x0a第二步:安装libevent-2.0.19-stable.tar.gz\x0d\x0a1.解压libevent-2.0.19-stable.tar.gz==>libevent-2.0.19-stable\x0d\x0a2.进入libevent-2.0.19-stable安装\x0d\x0a./configure--prefix=/usr/local/libevent\x0d\x0amake\x0d\x0amakeinstall\x0d\x0a3.添加软连接\x0d\x0aln-s/usr/local/libevent/lib/libevent-2.0.so.5/usr/lib/libevent-2.0.so.5\x0d\x0aln-s/usr/local/libevent/lib/libevent-2.0.so.5/usr/lib64/libevent-2.0.so.5\x0d\x0aln-s/usr/local/libevent/lib/libevent-2.0.so.5/lib64/libevent-2.0.so.5\x0d\x0aln-s/usr/local/libevent/lib/libevent-2.0.so.5/lib/libevent-2.0.so.5\x0d\x0aln-s/usr/local/libevent/lib/libevent-2.0.so.5/usr/local/lib64/libevent-2.0.so.5\x0d\x0aln-s/usr/local/libevent/lib/libevent-2.0.so.5/usr/local/lib/libevent-2.0.so.5\x0d\x0a第三步:安装FastDFS\x0d\x0a./make.shC_INCLUDE_PATH=/usr/local/libevent/includeLIBRARY_PATH=/usr/local/libevent/lib\x0d\x0a./make.shinstall\x0d\x0a第四步:如果/usr/local/fastdfs/conf没有fdfs_trackerd和fdfs_storaged这两个文件,就从/FastDFS/tracker和FastDFS/storage/目录下复制过去\x0d\x0a第五步:修改配置\x0d\x0amkdir-p/home/softinstall/data/tracker\x0d\x0a1.修改tracker.conf\x0d\x0abase_path=/home/softinstall/data/tracker\x0d\x0abind_addr=192.168.9.169\x0d\x0a1.1修改storage_ids.conf\x0d\x0a100001group1192.168.9.169\x0d\x0a2.启动tracker\x0d\x0a./fdfs_trackerd../conf/tracker.conf\x0d\x0a查看22122端口是否启动起来\x0d\x0a第六步:配置storage\x0d\x0amkdir-p/home/softinstall/data/store\x0d\x0amkdir-p/home/softinstall/data/store/store0\x0d\x0amkdir-p/home/softinstall/data/store/store1\x0d\x0amkdir-p/home/softinstall/data/store/store2\x0d\x0a1.修改storage.conf\x0d\x0abase_path=/home/softinstall/data/store\x0d\x0astore_path_count=3\x0d\x0astore_path0=/home/softinstall/data/store/store0\x0d\x0astore_path1=/home/softinstall/data/store/store1\x0d\x0astore_path2=/home/softinstall/data/store/store2\x0d\x0atracker_server=192.168.9.169:22122\x0d\x0a#限6*6=36个目录默认256*256\x0d\x0asubdir_count_per_path=6\x0d\x0a2.启动storage\x0d\x0a./fdfs_storaged../conf/storage.conf\x0d\x0a查看23000端口是否启动\x0d\x0a第七步:安装nginx+fastdfs模块\x0d\x0a1.安装pcre-8.32\x0d\x0a进入pcre-8.32\x0d\x0a./configure\x0d\x0amake\x0d\x0amakeinstall\x0d\x0a安装如果有问题缺省某些包,可以执行:\x0d\x0ayumgroupinstall"DevelopmentTools"\x0d\x0a第八步:解压fastdfs-nginx-module_v1.15.tar.gz和nginx-1.4.2.tar.gz\x0d\x0a1.进入fastdfs-nginx-module_v1.15/src\x0d\x0avimfastdfs-nginx-module_v1.15/src/config\x0d\x0a修改成以下内容\x0d\x0angx_addon_name=ngx_http_fastdfs_module\x0d\x0aHTTP_MODULES="$HTTP_MODULESngx_http_fastdfs_module"\x0d\x0aNGX_ADDON_SRCS="$NGX_ADDON_SRCS$ngx_addon_dir/ngx_http_fastdfs_module.c"\x0d\x0aCORE_INCS="$CORE_INCS/usr/local/fdfs/include/fastdfs/usr/local/fdfs/include/fastcommon/"\x0d\x0aCORE_LIBS="$CORE_LIBS-L/usr/local/fdfs/lib-lfastcommon-lfdfsclient"\x0d\x0aCFLAGS="$CFLAGS-D_FILE_OFFSET_BITS=64-DFDFS_OUTPUT_CHUNK_SIZE='256*1024'-DFDFS_MOD_CONF_FILENAME='\"/usr/local/fdfs/conf/mod_fastdfs.conf\"'"\x0d\x0a2.安装\x0d\x0a进入nginx-1.4.2目录\x0d\x0a./configure--prefix=/home/softinstall/nginx/nginx-fastdfs-install--with-pcre=/home/softinstall/nginx/pcre-8.32--add-module=/home/softinstall/nginx/fastdfs-nginx-module/src\x0d\x0a安装中如果有问题\x0d\x0a可以执行安装以下包:yum-yinstallgccgcc-c++zlib-developenssl-devel\x0d\x0a3.配置nginx.conf\x0d\x0a进入nginx-fastdfs-install/conf\x0d\x0avimnginx.conf配置以下内容\x0d\x0alocation/M00{\x0d\x0aroot/home/softinstall/data/store/store0/data\x0d\x0angx_fastdfs_module\x0d\x0a}\x0d\x0alocation/M01{\x0d\x0aroot/home/softinstall/data/store/store1/data\x0d\x0angx_fastdfs_module\x0d\x0a}\x0d\x0alocation/M02{\x0d\x0aroot/home/softinstall/data/store/store2/data\x0d\x0angx_fastdfs_module\x0d\x0a}\x0d\x0a4.配置mod_fastdfs.conf\x0d\x0amkdir-p/home/softinstall/data/nginx_mod\x0d\x0a进入/usr/local/fdfs/conf目录\x0d\x0avimmod_fastdfs.conf\x0d\x0abase_path=/home/softinstall/data/nginx_mod\x0d\x0atracker_server=192.168.9.169:22122\x0d\x0astore_path_count=3\x0d\x0astore_path0=/home/softinstall/data/store/store0\x0d\x0astore_path1=/home/softinstall/data/store/store1\x0d\x0astore_path2=/home/softinstall/data/store/store2\x0d\x0a5.启动nginx\x0d\x0a进入/home/softinstall/nginx/nginx-fastdfs-install/sbin\x0d\x0a./nginx\x0d\x0a如果启动找不到\x0d\x0aerrorwhileloadingsharedlibraries:libfdfsclient.so:cannotopensharedobjectfile:Nosuchfileordirectory\x0d\x0aerrorwhileloadingsharedlibraries:libfastcommon.so:cannotopensharedobjectfile:Nosuchfileordirectory\x0d\x0a请使用以下软连接\x0d\x0aln-s/usr/local/fdfs/lib/libfastcommon.so/usr/lib/libfastcommon.so\x0d\x0aln-s/usr/local/fdfs/lib/libfastcommon.so/usr/lib64/libfastcommon.so\x0d\x0aln-s/usr/local/fdfs/lib/libfdfsclient.so/usr/lib64/libfdfsclient.so\x0d\x0aln-s/usr/local/fdfs/lib/libfdfsclient.so/usr/lib/libfdfsclient.so\x0d\x0a==========================fastDHT================================\x0d\x0a【第一步:】安装BerkleyDB\x0d\x0a【1.】tar-zxvfdb-4.7.25.tar.gz\x0d\x0a进入db-4.7.25/build_unix\x0d\x0a../dist/configure--prefix=/usr\x0d\x0a【第二步:】安装FastDHT\x0d\x0amkdir-p/usr/local/fdht\x0d\x0amkdir-p/usr/local/fdht/conf\x0d\x0a1.tar-zxvfFastDHT_v1.23.tar.gz\x0d\x0a进入FastDHT_v1.23\x0d\x0avimmake.sh\x0d\x0a修改\x0d\x0aTARGET_PREFIX=/usr/local/fdht\x0d\x0aTARGET_CONF_PATH=/usr/local/fdht/conf\x0d\x0aif["$1"="install"]then\x0d\x0acd..\x0d\x0acp-frestart.sh$TARGET_PREFIX/bin\x0d\x0acp-fstop.sh$TARGET_PREFIX/bin\x0d\x0aif["$uname"="Linux"]then\x0d\x0aif["$WITH_LINUX_SERVICE"="1"]then\x0d\x0aif[!-d$TARGET_CONF_PATH]then\x0d\x0amkdir-p$TARGET_CONF_PATH\x0d\x0acp-fconf/fdhtd.conf$TARGET_CONF_PATH\x0d\x0acp-fconf/fdht_servers.conf$TARGET_CONF_PATH\x0d\x0acp-fconf/fdht_client.conf$TARGET_CONF_PATH\x0d\x0afi\x0d\x0acp-finit.d/fdhtd/etc/rc.d/init.d/\x0d\x0a/sbin/chkconfig--addfdhtd\x0d\x0afi\x0d\x0afi\x0d\x0afi\x0d\x0a【2.】安装\x0d\x0a./make.sh\x0d\x0a------------------------------------------------------------------------------\x0d\x0a如果出现global.h:18:19:error:event.h:Nosuchfileordirectory\x0d\x0a进入/home/softinstall/fastdfs/libevent-2.0.19-stable然后执行\x0d\x0a./configure--prefix=/usr\x0d\x0amake\x0d\x0amakeinstall\x0d\x0a---------------------------------------------------------------------------------\x0d\x0a./make.shinstall\x0d\x0a【3.】配置fdht\x0d\x0a【3.1】vim/usr/local/fdht/conf/fdhtd.conf\x0d\x0aport=11411\x0d\x0abash_path=/home/softinstall/data/fastdht\x0d\x0acache_size=32MB\x0d\x0astore_sub_keys=true\x0d\x0ause_storage_id=true\x0d\x0a#include/usr/local/fdht/conf/fdht_servers.conf(本行前有#表示打开,如果想关闭此选项,则应该为##开头)\x0d\x0a【3.2】vim/usr/local/fdht/conf/fdht_server.conf\x0d\x0agroup_count=1\x0d\x0agroup0=192.168.9.165:11411\x0d\x0a【3.3】vim/usr/local/fdht/conf/fdht_client.conf\x0d\x0akeep_alive=1(本选项关联storaged.conf文件)\x0d\x0abase_path=/home/softinstall/data/fastdht\x0d\x0a#include/usr/local/fdht/conf/fdht_servers.conf\x0d\x0a【3.4】配置FastDFS的storaged.conf文件\x0d\x0avistoraged.conf(默认位置:/usr/local/fdfs/conf/storaged.conf)\x0d\x0acheck_file_duplicate=1\x0d\x0a本配置项解释:是否检测上传文件已经存在。如果已经存在,则不存在文件内容,建立一个索引链接以节省磁盘空间\x0d\x0akey_namespace=FastDFS\x0d\x0a本配置项解释:当上个参数设定为1时,在FastDHT中的命名空间\x0d\x0akeep_alive=1\x0d\x0a本配置项解释:长连接配置选项,如果为0则为短连接1为长连接\x0d\x0a#include/usr/local/fdht/conf/fdht_servers.conf\x0d\x0a本配置项解释:可以通过#includefilename方式来加载FastDHTservers的配置\x0d\x0a【3.5】\x0d\x0a===========================总体启动流程======================================\x0d\x0a\x0d\x0a启动tracker/usr/local/fdfs/bin/fdfs_trackerd/usr/local/fdfs/conf/tracker.conf\x0d\x0a停止tracker/usr/local/fdfs/bin/stop.sh/usr/local/fdfs/conf/tracker.conf\x0d\x0a启动storage/usr/local/fdfs/bin/fdfs_storaged/usr/local/fdfs/conf/storage.conf\x0d\x0a停止storage/usr/local/fdfs/bin/stop.sh/usr/local/fdfs/conf/storage.conf\x0d\x0a\x0d\x0a启动nginx/

信号量在进程是以有名信号量进行通信的,在线程是以无名信号进行通信的,因为线程linux还没有实现进程间的通信,所以在sem_init的第二个参数要为0,而且在多线程间的同步是可以通过有名信号量也可通过无名信号,但是一般情况线程的同步是无名信号量,无名信号量使用简单,而且sem_t存储在进程空间中,有名信号量必须LINUX内核管理,由内核结构struct ipc_ids 存储,是随内核持续的,系统关闭,信号量则删除,当然也可以显示删除,通过系统调用删除,

消息队列,信号量,内存共享,这几个都是一样的原理。,只不过信号量分为有名与无名


欢迎分享,转载请注明来源:内存溢出

原文地址: http://outofmemory.cn/yw/7281602.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2023-04-03
下一篇 2023-04-03

发表评论

登录后才能评论

评论列表(0条)

保存