how to write java program to acquire admin permission
I want to write a java program which will ask for admin permission (admin username and admin password). If I insert the correct information then i will receive an welcome message.
how to write java program to acquire admin permission.
I am using Fedora 10 linux.
Thanks Sunil K开发者_运维技巧umar Sahoo
if i understand your question it is more about *nix passwords and logins. Have a look at the /etc/passwd and /etc/shadow files and research about how the passwords are hashed. Once you understand that you may write a java program to hash the input password and compare it with the content of /etc/shadow...
Have a look at Shadow_password
Look at System.out.println for prompting the user and displaying the welcome message (assuming you do not have to use a GUI). Look at Scanner(System.in) or the Console class to read the password. Use an "if" statement to check if the password .equals the expected password (assuming it is not held in some sort of database/file).
精彩评论