क्या करता है `adduser --disabled-login` करते हैं?


16

उपयोगकर्ता को जोड़ने के लिए मैं निम्नलिखित निर्देश स्थापित कर रहा हूं जैसे एक उपयोगकर्ता:

sudo adduser --disabled-login --gecos 'GitLab' git

--disabled-loginझंडा सबसे आदमी पृष्ठों मैं खोज की है से अनुपस्थित है।

मैंने दो उपयोगकर्ता बनाये हैं, एक के साथ --disabled-login( foo), और एक बिना (git ) के।

जहां तक ​​मैं बता सकता हूं कि --disabled-loginझंडा कुछ नहीं करता है। मैं अभी भी suदोनों उपयोगकर्ताओं के लिए, और दोनों /bin/bashअपने लॉगिन शेल के रूप में उपयोग कर सकते हैं ।

एकमात्र अंतर जो मैं देख सकता हूं getent passwdकि लॉगिन पर अक्षम उपयोगकर्ता के होम फ़ोल्डर से पहले अतिरिक्त कॉमा है। नहीं है कोई प्रलेखन है कि मैं से संकेत मिलता है कि इसका क्या मतलब होगा पा सकते हैं।

root@gitlab:~# getent passwd git
git:x:998:998:GitLab:/home/git:/bin/bash  

root@gitlab:~# getent passwd foo
foo:x:1001:1002:GitLab,,,:/home/foo:/bin/bash

अद्यतन # 1

मुझे एक और अंतर मिला है, एक उपयोगकर्ता के पास *अपना पासवर्ड है, दूसरे के पास है !:

root@gitlab:~# getent shadow git
git:*:15998::::::
root@gitlab:~# getent shadow foo
foo:!:15998:0:99999:7:::

--disabled-loginउबंटू पर वास्तव में क्या करता है?


रिकॉर्ड के लिए, अतिरिक्त कॉमा "जीकोस" फ़ील्ड के भीतर फ़ील्ड्स को अलग करते हैं: पूरा नाम, कमरा नंबर, काम फोन, घर फोन। मुझे नहीं पता कि वे एक संस्करण में क्यों मौजूद होंगे और अन्य नहीं। आप chfnटूल के मैनपेज में इस पर प्रलेखन पा सकते हैं ।
रैंडम 832

यह समझ आता है। जब मैंने उपयोगकर्ताओं में से एक को जोड़ा तो मैंने गलती से उस सूचना में प्रवेश करने के लिए 'y' को चुना। दूसरे उपयोगकर्ता को कठपुतली के माध्यम से जोड़ा गया था।
स्पूडर

जवाबों:


17

स्पष्टीकरण अच्छी तरह से प्रलेखित नहीं है।

--disabled-login पासवर्ड सेट करता है !

पासवर्ड मान

NP or null = The account has no password
*  = The account is deactivated & locked
!  = The login is deactivated, user will be unable to login
!!  = The password has expired

उदाहरण

root@gitlab:~# getent shadow vagrant
vagrant:$6$abcdefghijklmnopqrstuvwxyz/:15805:0:99999:7:::

root@gitlab:~# getent shadow foo
foo:!:15998:0:99999:7:::

root@gitlab:~# getent shadow git
git:*:15998::::::

विकिपीडिया संक्षेप में इसे शामिल करता है। ऐसा प्रतीत होता है कि * और! प्रभावी रूप से एक ही काम करते हैं; उपयोगकर्ता को लॉगिन करने से रोकें (लेकिन किसी अन्य उपयोगकर्ता से su'ing से नहीं)


3

यह shadowमैन पेज में आंशिक रूप से चर्चा की गई है ।

अंश

$ man shadow
...
...
encrypted password
     Refer to crypt(3) for details on how this string is interpreted.

     If the password field contains some string that is not a valid result of 
     crypt(3), for instance ! or *, the user will not be able to use a unix
     password to log in (but the user may log in the system by other means).

     This field may be empty, in which case no passwords are required to 
     authenticate as the specified login name. However, some applications which
     read the /etc/shadow file may decide not to permit any access at all if the
     password field is empty.

     A password field which starts with a exclamation mark means that the 
     password is locked. The remaining characters on the line represent the 
     password field before the password was locked.

adduserवहाँ संदर्भित है इसके लिए मैन पेज के आपके संस्करण पर निर्भर करता है ।

अंश योजक पेज

--disabled-login
       Do  not  run passwd to set the password.  The user won't be able
       to use her account until the password is set.

--disabled-password
       Like --disabled-login, but logins are still possible (for  exam-
       ple using SSH RSA keys) but not using password authentication.
हमारी साइट का प्रयोग करके, आप स्वीकार करते हैं कि आपने हमारी Cookie Policy और निजता नीति को पढ़ और समझा लिया है।
Licensed under cc by-sa 3.0 with attribution required.