现在的位置: 首页 > 综合 > 正文

debian下给用户添加权限

2018年09月08日 ⁄ 综合 ⁄ 共 4182字 ⁄ 字号 评论关闭

Debian 添加普通用户并添加sudo权限

首先添加一个用户组:

1
groupadd humou

添加用户,设置主目录,shell路径

1
useradd -g humou -d /home/humou -s /bin/bash -m humou

shell路径设置不对,该用户会无法登录

或者直接:

1
useradd -g humou humou

设置密码

1
passwd humou

删除一个用户:

1
userdel humou

相应的用户组也会一并删除

查看某用户的信息:

1
id humou

查看系统中的全部用户:

1
cat /etc/passwd

给普通用户sudo权限:

1
visudo

找到:

1
root ALL=(ALL) ALL

在下面添加

1
humou ALL=(ALL) ALL

如需用户使用sudo时不输入密码,则为:

1
humou ALL=NOPASSWD: ALL

http://wiki.debian.org/sudo

adduser menxu sudo

 sudo apt-get install build-essential bison openssl libreadline6 libreadline6-dev curl git-core zlib1g zlib1g-dev libssl-dev libyaml-dev  libxml2-dev libxslt-dev autoconf libc6-dev zlib1g-dev libssl-dev build-essential curl git-core libc6-dev g++ gcc

bash < <(curl -s https://raw.github.com/wayneeseguin/rvm/master/binscripts/rvm-installer)

source .bashrc



cat .bashrc 


 rvm ls known

rvm

rvm requirements

rvm install ruby-2.0.0

 rvm ls

 rvm use 2.0.0 --default

gem -v

 gem install passenger

 rvmsudo passenger-install-nginx-module

sudo apt-get install libcurl4-openssl-dev

gem source -r https://rubygems.org/

gem source -a http://ruby.taobao.org

gem install bundler rails

$ bundle -v

 Bundler version 1.0

 $ rails -v

 Rails 3.2.13

sudo apt-get install nginx-common

wget https://raw.github.com/gist/1548664/53f6d7ccb9dfc82a50c95e9f6e2e60dc59e4c2fb/nginx

sudo cp nginx /etc/init.d/

 sudo chmod +x /etc/init.d/nginx

sudo update-rc.d nginx defaults 

sudo cp /etc/nginx/nginx.conf  /etc/nginx/nginx_copy.conf

 sudo gedit /etc/nginx/nginx.conf

$ sudo /etc/init.d/nginx start

gem install passenger
rvmsudo passenger-install-nginx-module

wget https://raw.github.com/gist/1548664/53f6d7ccb9dfc82a50c95e9f6e2e60dc59e4c2fb/nginx

sudo cp nginx /etc/init.d/
sudo chmod +x /etc/init.d/nginx
sudo update-rc.d nginx defaults

ps aux | grep nginx

sudo kill 7108

sudo /opt/nginx/

--------------------------------------------

#user  nobody;
worker_processes  1;

#error_log  logs/error.log;
#error_log  logs/error.log  notice;
#error_log  logs/error.log  info;

#pid        logs/nginx.pid;

events {
    worker_connections  1024;
}

http {
    passenger_root /home/menxu/.rvm/gems/ruby-2.0.0-p195@blog2/gems/passenger-4.0.2;
    passenger_ruby /home/menxu/.rvm/wrappers/ruby-2.0.0-p195@blog2/ruby;

    include       mime.types;
    default_type  application/octet-stream;

    #log_format  main  '$remote_addr - $remote_user [$time_local] "$request" '
    #                  '$status $body_bytes_sent "$http_referer" '
    #                  '"$http_user_agent" "$http_x_forwarded_for"';

    #access_log  logs/access.log  main;

    sendfile        on;
    #tcp_nopush     on;

    #keepalive_timeout  0;
    keepalive_timeout  65;

    #gzip  on;

    server {
        listen       80;
        server_name  localhost;

        #charset koi8-r;

        #access_log  logs/host.access.log  main;

        location / {
            root   html;
            index  index.html index.htm;
        }

        #error_page  404              /404.html;

        # redirect server error pages to the static page /50x.html
        #
        error_page   500 502 503 504  /50x.html;
        location = /50x.html {
            root   html;
        }

        # proxy the PHP scripts to Apache listening on 127.0.0.1:80
        #
        #location ~ \.php$ {
        #    proxy_pass   http://127.0.0.1;
        #}

        # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
        #
        #location ~ \.php$ {
        #    root           html;
        #    fastcgi_pass   127.0.0.1:9000;
        #    fastcgi_index  index.php;
        #    fastcgi_param  SCRIPT_FILENAME  /scripts$fastcgi_script_name;
        #    include        fastcgi_params;
        #}

        # deny access to .htaccess files, if Apache's document root
        # concurs with nginx's one
        #
        #location ~ /\.ht {
        #    deny  all;
        #}
    }

    # another virtual host using mix of IP-, name-, and port-based configuration
    #
    #server {
    #    listen       8000;
    #    listen       somename:8080;
    #    server_name  somename  alias  another.alias;

    #    location / {
    #        root   html;
    #        index  index.html index.htm;
    #    }
    #}

    # HTTPS server
    #
    server {
        listen       80;
        server_name  www.menxu.com;

    #    ssl                  on;
    #    ssl_certificate      cert.pem;
    #    ssl_certificate_key  cert.key;

    #    ssl_session_timeout  5m;

    #    ssl_protocols  SSLv2 SSLv3 TLSv1;
    #    ssl_ciphers  HIGH:!aNULL:!MD5;
    #    ssl_prefer_server_ciphers   on;

    #    location / {
    #        root   html;
    #        index  index.html index.htm;
    #    }
    root /home/menxu/文档/ruby/blogs/public;
        passenger_enabled on;
    }

}

抱歉!评论已关闭.