Home | 簡體中文 | 繁體中文 | 雜文 | Search | ITEYE 博客 | OSChina 博客 | Facebook | Linkedin | Email

8.3. inet.conf / xinetd 方式啟動

過程 8.1. git-daemon

  1. /etc/shells

    /etc/shells 最後一行添加 '/usr/bin/git-shell'

    $ grep git /etc/shells
    /usr/bin/git-shell
    				
  2. add new user 'git' and 'gitroot' for git

    you need to assign shell with /usr/bin/git-shell

    $ sudo adduser git --shell /usr/bin/git-shell
    $ sudo adduser gitroot --ingroup git --shell /bin/bash
    				

    /etc/passwd

    $ grep git /etc/passwd
    git:x:1001:1002:,,,:/home/git:/usr/bin/git-shell
    gitroot:x:1002:1002:,,,:/home/gitroot:/bin/bash
    				
  3. /etc/services

    $ grep 9418 /etc/services
    git             9418/tcp                        # Git Version Control System
    				
  4. /etc/inet.conf

    $ grep git /etc/inet.conf
    git     stream  tcp     nowait  nobody \
      /usr/bin/git-daemon git-daemon --inetd --syslog --export-all /home/gitroot
    				

    reload inetd

    $ sudo pkill -HUP inetd
    				
  5. xinetd

    目前的Linux逐漸使用xinetd.d替代inet.conf,如Redhat系列已經不再使用inet.conf, Ubuntu系列發行版已經不預裝inet與xinetd

    $ apt-cache search xinetd
    globus-gfork-progs - Globus Toolkit - GFork Programs
    rlinetd - gruesomely over-featured inetd replacement
    update-inetd - inetd configuration file updater
    xinetd - replacement for inetd with many enhancements
    
    $ sudo apt-get install xinetd
    				

    /etc/xinetd.d/

    $ cat /etc/xinetd.d/git
    # default: off
    # description: The git server offers access to git repositories
    service git
    {
            disable 		= no
            type            = UNLISTED
            port            = 9418
            socket_type     = stream
            protocol 		= tcp
            wait            = no
            user            = gitroot
            server          = /usr/bin/git
            server_args     = daemon --inetd --export-all --enable=receive-pack --reuseaddr --base-path=/home/gitroot
            log_on_failure  += USERID
    }
    				

    reload xinitd

    $ sudo /etc/init.d/xinetd reload
     * Reloading internet superserver configuration xinetd                                       [ OK ]
    				
comments powered by Disqus