I dont think you need to create any session id for this. in http protocol session is important to identify the user. cause after transferring data between server and client the connection is terminated. but in case FTP it close its connection when it get an exit request from client.
But if you want to enable timing issue then its a different issue. By timing i mean 'Disconnection inactive user'
you should take a look at
select[
^] function can disconnect at in active user