Change the password in 30 days in sftp script.


 
Thread Tools Search this Thread
Top Forums UNIX for Advanced & Expert Users Change the password in 30 days in sftp script.
# 1  
Old 08-23-2005
Change the password in 30 days in sftp script.

Hi,

I'm writing a script which actually sftp's(gets!! i'm using mget) files from a windows box to unix server. (i've gone thru forum and got pretty good answers, Thx for that).

but the windows box to which i'm ftp'g prompts for a password change every 30 days. so please suggest me how to do this.

also based on file name i need to ftp files to a different location, for example..

if file name is xxx0173.052305 then i need to read this name and according to whats in place of 173 i need to push it to a specific folder say d173 or if its 125 the file should go to d125.

Thanks in advance all..
# 2  
Old 08-24-2005
The first problem is not easy, but second one is:

Code:
filename="xxx0173.052305"
print - "$filename" | sed 's/^xxx0\([^.]*\).*$/\1/'    # will yield "173"

# hence (we assume the variable $filename to be there):

typeset chFileSig="$(print - "$filename" | sed 's/^xxx0\([^.]*\).*$/\1/')"

mv $filename /path/to/dir/d${chFileSig}

Hope this helps.

bakunin
# 3  
Old 08-24-2005
yeah thats one way of doing it !!... but the file name is to be taken from the directory and not hardcoded.
I need to pick file names with extention of today's date... for example ".051201" so how do i pick up these files...?
# 4  
Old 08-24-2005
Code:
#!/bin/ksh
today="$(date +%m%d%y)"

for filename in *.${today}
do
   print - "$filename" | sed 's/^xxx0\([^.]*\).*$/\1/'    # will yield "173"
   # hence (we assume the variable $filename to be there):
   typeset chFileSig="$(print - "$filename" | sed 's/^xxx0\([^.]*\).*$/\1/')"

   mv "$filename" "/path/to/dir/d${chFileSig}"
done

Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

SFTP script still asking password

Hi All, I have FTP script snippet targetFTP=testcomp userID=testid userPass=XXXXX server_availability () { echo "***********************************************************" >> $FtpLog echo "* Server Availability & User Access Checks *" >> $FtpLog echo... (2 Replies)
Discussion started by: Riverstone
2 Replies

2. Shell Programming and Scripting

SFTP or scp with password in a batch script without using SSH keys and expect script

Dear All, I have a requirement where I have to SFTP or SCP a file in a batch script. Unfortunately, the destination server setup is such that it doesn't allow for shell command line login. So, I am not able to set up SSH keys. My source server is having issues with Expect. So, unable to use... (5 Replies)
Discussion started by: ss112233
5 Replies

3. UNIX for Advanced & Expert Users

Change login password for SFTP Only ID

Hi All, I have an SFTP server where there are user id's created for vendors and given only SFTP access for them (eg: given below) jim.tran:x:10040:10008:abc.def@ghi.com:/dropbox:/bin/false They cannot login to the server via SSH and can only do an SFTP. These users are set up as jailed... (1 Reply)
Discussion started by: nathsaba
1 Replies

4. Shell Programming and Scripting

SFTP prompting for password even though password is in script

Hi All, I am trying to transfer a file from one server to a remote server using SFTP. Client is not ready for key setup. I am working on Solaris 10. Here is the code. #!/bin/ksh # sample automatic Sftp script to dump a file USER="user1" PASSWORD="pass1" HOST="host1" sftp $USER@$HOST... (6 Replies)
Discussion started by: megha2525
6 Replies

5. UNIX for Dummies Questions & Answers

Script to log in SFTP server [with username, password]

Hi, everyone, I am trying to write a script to login automatically using username and password to an sftp server (the key authentication has been disabled so I cannot use that method). I tried to search online for a solution and found a way using "expect" but my boss does not want me to use... (4 Replies)
Discussion started by: warmboy610
4 Replies

6. Shell Programming and Scripting

Sftp - password change / expired

What happens to sftp when unix password expires / changes ? Do we need to regenerate keys again ? Please help. (3 Replies)
Discussion started by: vegasluxor
3 Replies

7. Shell Programming and Scripting

SFTP password through shell script.

Hi All, I would be happy, if someone help me on this that I have only SFTP ID and Password to transfer some log files from webserver boxes to SFTP server Anyone help me that how to pass the password parameter throough the shell scripts, since i don't have ssh login access on the SFTP... (2 Replies)
Discussion started by: l_gshankar24
2 Replies

8. Shell Programming and Scripting

sftp batch script with password

I am working on a sftp batch script on a Solaris machine and I need to connect using password. This is not an issue when i do it manually but when I want to make this into a script, i find there are no options for password. Can anyone suggest how I can do it with password? I know using keys is... (3 Replies)
Discussion started by: Leion
3 Replies

9. Shell Programming and Scripting

how to change root password using shell script with standard password

Hi Friends. I am new to scripting now i want to change the root password using the script with standard password. which is the easy scripting to learn for the beginner, Thanks in advance. (2 Replies)
Discussion started by: kurva
2 Replies

10. Solaris

forcing password change every X days?

Hi, how do I go about forcing users to change their password every, say, 30 days? Aaron (1 Reply)
Discussion started by: amheck
1 Replies
Login or Register to Ask a Question