Analysis on automatic arch startup authentication

Source: Internet
Author: User
Analysis of automatic arch boot authentication a few days ago, I started the automatic boot authentication. The environment is arch. The school certification is H3C, but the official linux authentication client provided by the school is bloated and only supports ubuntu, rehat and derivative versions. Fortunately, this problem has been solved by Daniel and a small python version has been recognized...
Analysis of automatic arch boot authentication a few days ago, I started the automatic boot authentication. The environment is arch. The school certification is H3C, but the official linux authentication client provided by the school is bloated and only supports ubuntu, rehat and derivative versions. Fortunately, Daniel has solved this problem. a small python version of the authentication client yah3c runs yah3c as long as you enter sudo yah3c on the terminal, but because sudo is used, you must also manually enter the password. when running yah3c, you must also choose whether to create a new account or which account you have used. To enable auto-start authentication for an experiment, you must remove the two inputs. First, remove the sudo password. run sudo login do to add www.2cto.com 1 $ user all = NOPASSWD:/usr/bin/yah3c. Note that you cannot directly modify the/etc/sudoers file. Sudo cannot be used because the sudoers file permission is changed during file modification. In addition, every execution of sudo reads/ets/sudoers, that is, once you change/etc/sudoers, you have no chance to use sudo to correct the permissions of the sudoers file .. The only way is to log on with the root account and change the/etc/sudoers permission to 0440. as for the yah3c selection input, you need to modify the yah3c code. the code to be modified is in/usr/lib/python2.7/site-packages/yah3c/yah3c. py. Locate 51 rows, comment out 1 choice = int (raw_input ('your choice: '), and add 1 choice = 1 in the following line. because yah3c is only used for authentication, you also need to use networkmanager or dhcp to automatically obtain the ip address. Networkmanager is used here. the command is as follows: www.2cto.com 1 nmcli con up id "name of the wired connection" and you need to consider that if the first authentication fails, it can be cyclically authenticated. The method for determining whether the authentication is successful is to check whether the ip address can be obtained. You can use ifconfig to check the ip address and then use the regular expression. The code is as follows: 1 ifconfig eth0 | grep inet | grep-v inet6 | grep-v 127.0.0.1 | awk '{print $2}. Considering the possible wireless network environment, therefore, check whether the ip address can be obtained through wlan0. If yes, exit the loop to avoid an endless loop. 1 if [-z $ theip] 2 then3 theip = 'ifconfig wlan0 | grep inet | grep-v inet6 | grep-v 127.0.0.1 | awk '{print $2}' '4 fi the final script is as follows: 01 #! /Bin/bash02 www.2cto.com theip = ''; 03 while [-z $ theip] 04do05 sudo yah3c06 sleep 207 nmcli con up id "Wired connection 1" 08 sleep 209 theip = 'ifconfig eth0 | grep inet | grep-v inet6 | grep -v 127.0.0.1 | awk '{print $2} ''10 if [-z $ theip] 11 then12 theip = 'ifconfig wlan0 | grep inet | grep-v inet6 | grep-v 127.0.0.1 | awk '{print $2}' 13 www.2cto.com fi14 done is to put the script in a proper place. I use the kde environment. it runs automatically after the kde environment is ready ~ /. Kde4/Autostart/scripts in the folder. So I put the script there. It seems that this is done, but a bug is found in practice... After automatic authentication, you can access the Internet at first. But sometimes it will automatically drop after a while. I do not know whether it is a problem with the mechanism of kde4/Autostart or yah3c .. In addition, I think it is a stupid method to enable automatic startup. if the script can be started when a network connection is detected for the first time, perfect will be available.
 
Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.