hello chage command is a useful command for set expire date (suspend user) :
-E switch will update the “Account expires” value as shown below: chage -E "2009-05-31" username
how can i write this shell script which can find present date and plus it with the value that user set,
like today is 2014-05-31, user enter 60 when script ask hi the expire period,
script must add 60 days to 2014-05-31 and store it in date.txt file
very god,
ok now how can i list all users from /home and add them to $USERNAMES with loop ?
this script has to list all users from /home with ls /home chage -l $USERNAMES | grep "Account expires" | cut -d: -f2 2> LIST.txt
---------- Post updated at 11:05 AM ---------- Previous update was at 10:21 AM ----------
checkout this code, the output is not what i want, echo username + expire date to new dile
---------- Post updated at 12:49 PM ---------- Previous update was at 11:05 AM ----------
chage send an unknown user error after 3 times, checout these errors
chage: unknown user user4
chage: unknown user nima5
you can run my script in your machine and check it will stop after for or while command run 3 times,
Try this corrected version, which is based on your own attempts:
If it works, please use the while loop version, which is more appropriate for this task. It does the same as the for loop, but in a "cleaner" way:
This User Gave Thanks to junior-helper For This Post:
i try to set linux date & time in specific format but it keep giving me error
Example :
date "+%d-%m-%C%y %H:%M:%S" -d "19-01-2017 00:05:01"
or
date +"%d-%m-%C%y %H:%M:%S" -d "19-01-2017 00:05:01"
keep giving me this error :
date: invalid date ‘19-01-2017 00:05:01'
Please use CODE tags... (7 Replies)
Hi! All,
I am trying to reset the date and time since the change in time over the weekend. I cannot issue the command date -t 201703131330.
The system gives me an error invalid option.
This happens on my SCO OpenServer 5.0.7 and 5.0.6. Do anyone have an idea why? I even tried using... (6 Replies)
Hi,
I have a requirement where in i need to write a shell script to set users password to never expire. I know the command which is used to perform the same .. which is chage command.
But, could not figure out how to do the same in shell script.
Could you please help me with the shell... (3 Replies)
Scenario: Admin wants to grant user temporary access to sudo that will expire on an arbitrary date\day. Say, after 10 days, sudo rights disappear automatically.
I'm sure there's a way to hack something together with a script or cron job, but I was wondering if anyone has a package \ tool \ other... (3 Replies)
Hi,
If User1, User2 and User3 are in the same group. User1 should not be able to view the files of User2 and User3. But User2 and User3 should be able to view all files.
How to set permission for this.
Please help.
Thanks,
Priya. (1 Reply)
I am testing a script and need to change the system date to Nov 30 2009. I cannot seem to find a way to do this other than TZ command but it does not seem to work correctly.
I tried TZ=GMT+168 date but it is returning todays date
Mon Dec 7 19:48:11 GMT 2009
...instead of Nov 30 2009
I... (4 Replies)
Hi All,
Is this true on chage command?
-M, MAX_DAYS
Passing the number -1 as MAX_DAYS will remove checking a password's validity.
Does this means password will not expire anymore?
Thanks for any comment you may add. (0 Replies)
We have a Solaris box. I noticed that whenever any non-root user logins into the box and issues the command id the output is (for example) uid=42568(sam) gid=1245(sam) euid=0(root) egid=2(bin). I have not given any privileges to anyone explicitly. When I issued ls -l in the /usr/bin directory I... (1 Reply)
Hello
I want to set the password for user never expire through the command line. For your information the box is running under Solaris 8 platform. (2 Replies)