Question: #1. Write a Python script (name it user2.py) to do the following task: (1) prompts you for a user ID, (2) then read passwd1.txt file
#1. Write a Python script (name it "user2.py") to do the following task:
(1) prompts you for a user ID, (2) then read passwd1.txt file in the present working directory (as shown below) and then (3) displays login name, users name, uid and gid, pathname for users home directory, and user's default shell.
$ cat passwd1.txt
SYSTEM:*:18:544:,S-1-5-18::
LocalService:*:19:544:U-NT AUTHORITY\LocalService,S-1-5-19::
NetworkService:*:20:544:U-NT AUTHORITY\NetworkService,S-1-5-20::
Administrators:*:544:544:S-1-5-32-544::
Administrator:*:500:513:U-richard-PC\Admin:/home/Administrator:/bin/bash
Guest:*:501:513:U-richard-PC\Guest:/home/Guest:/bin/bash
rkm010300:*:1000:513:Richard Min email - rkm010300:/home/rkm010300:/bin/bash
john:*:1010:600:John-Staff:/home/john:/bin/sh
$ ./user2.py rkm010300
userid: rkm010300
uid: 1000
gid: 513
home directory: /home/rkm010300
shell:/bin/bash
Answer (copy and paste your anwer here) and mark it yellow (for background color).
#!/bin/python
print("Enter user-name: ");
exit(0);
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
