LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Software (https://www.linuxquestions.org/questions/linux-software-2/)
-   -   Script run as user login or logout in Vsftpd server (https://www.linuxquestions.org/questions/linux-software-2/script-run-as-user-login-or-logout-in-vsftpd-server-539203/)

singhpps 03-20-2007 10:56 PM

Script run as user login or logout in Vsftpd server
 
Hi

I want to make changes in my vsftpd server so that user can upload their files but cant delete. change ownership configuration is there but that is only for one owner. in my scenario there are more than one owner for different directories. can anyone guide me how to make a script executable when user login or if any user logout from vsftpd server. so that i can run the script to change the owner. setuid bit is not working on directory in Linux red hat. Please help me.

fotoguy 03-28-2007 06:54 AM

I would add the vsftp users to their own group, then add a line in the /etc/profile file to run commands when they log in. Say for example you create a group called vsftpuser and has a group id number of 110, you could write something like this:

if [ $UID = "110" ]; then
then do something here
fi


As for logging out I'm not sure how to do that, never had any need for it in the past

singhpps 03-28-2007 11:34 PM

Hi thanks a lot for your reply
 
I have done that in different way mentioned below:-

FTP Server Delete Restriction Settings User Bases

In this scenario we have two users test1 and test2
We will revoke deletion rights from user test2
Add an entry in Vsftpd.conf “user_config_dir=/etc/vsftpd/users/”
Create file in /etc/vsftpd /users/ by the name of User in this case it is test2
Add this in the file test2 :-
cmds_allowed=ABOR,CWD,LIST,MDTM,MKD,NLST,PASS,PASV,PORT,PWD,QUIT,RETR,RMD,RNFR,RNTO,SIZE,STOR,TYPE,U SER,ACCT,APPE,CDUP,HELP,MODE,NOOP,REIN,STAT,STOU,STRU,SYST

6. Restart the service
7. From now Test2 can upload files but can’t delete but Test1 can do the both
8. This is tested on vsftpd server 2.0 centos 4.4 linux

#
# ABOR - abort a file transfer
# CWD - change working directory
# DELE - delete a remote file
# LIST - list remote files
# MDTM - return the modification time of a file
# MKD - make a remote directory
# NLST - name list of remote directory
# PASS - send password
# PASV - enter passive mode
# PORT - open a data port
# PWD - print working directory
# QUIT - terminate the connection
# RETR - retrieve a remote file
# RMD - remove a remote directory
# RNFR - rename from
# RNTO - rename to
# SITE - site-specific commands
# SIZE - return the size of a file
# STOR - store a file on the remote host
# TYPE - set transfer type
# USER - send username
#
# less common commands:
# ACCT* - send account information
# APPE - append to a remote file
# CDUP - CWD to the parent of the current directory
# HELP - return help on using the server
# MODE - set transfer mode
# NOOP - do nothing
# REIN* - reinitialize the connection
# STAT - return server status
# STOU - store a file uniquely
# STRU - set file transfer structure
# SYST - return system type



Prepared and tested by:
Pritpal Singh

farooq.pathan 11-26-2010 12:53 AM

Thanks for the help.

Is there anyway we can run some script for example copy script which would copy the uploaded data to another folder after successful upload.

Help appreciated.

Thanks

GrapefruiTgirl 11-27-2010 11:06 AM

Quote:

Originally Posted by farooq.pathan (Post 4171452)
Thanks for the help.

Is there anyway we can run some script for example copy script which would copy the uploaded data to another folder after successful upload.

Help appreciated.

Thanks

Hi farooq,

technically this is a hijack - you posted your question onto someone else's thread. Not to mention, a 3 year old thread. :)

Over here:
http://www.linuxquestions.org/questi...upload-846904/
I have pruned your question off of another of your threads and given it a thread of its own. And while the "Server" forum is an OK place for the question, you might decide you would prefer to have posted it in the "Programming" forum, since you are after all asking for help with a script. If you would like the thread moved to "Programming", just click the REPORT button on the first post in the thread, and ask a moderator to move it for you.

Cheers!


All times are GMT -5. The time now is 11:29 AM.