disallow change directory


 
Thread Tools Search this Thread
Operating Systems AIX disallow change directory
# 1  
Old 01-18-2012
disallow change directory

Dear all expects,
I have a security problem that I would like to resolve.
I need to create a user ID in my AIX 5.3 environment and to point the login to a specific directory for FTP purposes. There is only 2 directories that I can allow the user ID to perform read/write. I would like to prevent the user ID to go other places for read / writing..

User ID : TestFTP
Home Directory : /home/TestFTP
/home/TestFTP/.profile : cd /data06/ABC01

Thus, it ends up sign in to /data06/ABC01.
It should be allowed to read/write on /data06/ABC01 and /data06/ABC01/ABC01_BAK.

Other than that, it cannot cd .. to go back to /data06 or it cannot cd to any other directories.

May I know how to create such as ID?

Thanks.
# 2  
Old 01-18-2012
One such method

Well one such method would be this:

create the user as usual, but give them the home directory as /data06/ABC01 and give them a shell of /bin/false.

So they would look this this in the /etc/passwd file:
TestFTP:x:1007:33:Chroot account for abc:/data06/ABC01:/bin/false
(of course the UID and GID #'s would be different)

Next, edit /etc/ssh/sshd_config and add the following:
Code:
Match User TestFTP
      ChrootDirectory /data06/ABC01
      ForceCommand internal-sftp
      X11Forwarding no
      AllowTcpForwarding no

This will enable the user to sftp in and have access to /data06/ABC01 and any folders below it. I see a couple of problems here:
* the .profile doing a cd /data06/ABC01 won't work, as it's a chroot environment. This can be commented out.
* As the chrootDirectory is /data06/ABC01 both would have to be root owned with no write access for group and/or everyone. If you require RW to the ABC01 directory, this is going to give problems (and you've requested no access to /data06).

A method I've implemented with another product seems to work fine (but uses ftps instead) was to install proftpd with SSl/TLS support compiled in.
Set it up to use a chrootDirectory, and make it /data06/ABC01 (for either TestFTP user or all users). This will allow rw access to /data06/ABC01, and have no access to /data06

Last edited by smurphy_it; 01-18-2012 at 11:28 AM.. Reason: Additional suggestion
# 3  
Old 01-18-2012
I have used MySecureShell - Index as well.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Change directory shell

#!/bin/bash echo -n "Enter number of sanger patients : "; read id perl -ne 'chomp; system ("perl table_annovar.pl $_ humandb/ -buildver hg19 -protocol refGene,popfreq_all,common,clinvar,clinvarsubmit,clinvarreference -operation g,f,f,f,f,f -otherinfo")' < file.txt I have the above script... (7 Replies)
Discussion started by: cmccabe
7 Replies

2. Shell Programming and Scripting

Change Directory

Hi All, There is a code like below in my script ############################################### ###Create Directories and Sub-Directories ############################################### dpdir=DP_FROM_${from}_TO_${to} mkdir $dpdir cd $dpdir mkdir AWQM WFCONTROLLER PROVCO PRISM ... (1 Reply)
Discussion started by: pvmanikandan
1 Replies

3. Shell Programming and Scripting

Change to directory and search some file in that directory in single command

I am trying to do the following task : export ENV=aaa export ENV_PATH=$(cd /apps | ls | grep $ENV) However, it's not working. What's the way to change to directory and search some file in that directory in single command Please help. (2 Replies)
Discussion started by: saurau
2 Replies

4. UNIX for Dummies Questions & Answers

How to change database directory to another directory?

Hi, I Installed mysql on my CentOS 6.2 Server. But when I tried to change the location of /var/lib/mysql to another directory. I can't start the mysql. Below is what I've done yum install mysql mysql-server mysql-devel mkdir /path/to/new/ cp -R /var/lib/mysql /path/to/new chown -R... (1 Reply)
Discussion started by: ganitolngyundre
1 Replies

5. Shell Programming and Scripting

change directory if available

I have a simple shell script that prompts the user to enter a directory to navigate to. What i want it to do and i don't know how to do this is if the directory is invalid automatically navigate to the home directory. echo "enter a directory to navigate to:" read directory cd $directory... (6 Replies)
Discussion started by: icelated
6 Replies

6. UNIX for Advanced & Expert Users

Disallow new ssh connections for a while ?

Hello, What is the best way to disallow new ssh connections for the duration of my session ? I want to evade read/write collisions. Things work like that - one session put files on server, other copies these files and then deletes them. So in order to evade collision: - I check if there are... (1 Reply)
Discussion started by: vilius
1 Replies

7. UNIX for Dummies Questions & Answers

Change Directory

I have a directory that is existing under my root dir of the FTP server. The DIR name is 'Software Patch'. I want to move in to that DIR to download some patches. But, when I issued a command 'cd SOftware Patch', the system said that it cannot find the dir 'Software'. I tried all possible ways like... (2 Replies)
Discussion started by: vskr72
2 Replies

8. Shell Programming and Scripting

change directory

hi, Iam in directory A. I run a script from there. inside the script i have a command cd B. When i come out of the script directory is A only. Even when i come out scrip i want the directory to be B How to achieve (2 Replies)
Discussion started by: mkan
2 Replies

9. Shell Programming and Scripting

Change directory command (cd)

I want to limit the directories that a user can access. When this users logs in, I do not want them to cd to any directory but those in their $HOME. In other words: login: pwd: /home/user cd / -- user tries to cd to root directory. pwd /home/user -- user is still in home... (4 Replies)
Discussion started by: oscarr
4 Replies

10. Shell Programming and Scripting

change directory

Hi all, I'm trying to wirte a small shell script in Linux. My script has the flow like, cmd1 cmd2 cd testdata cmd3 After exiting the program, the CWD remains the same as where I execute the program. I need it to be changed to the latest updated directory in the program. How can I do... (1 Reply)
Discussion started by: vadivel
1 Replies
Login or Register to Ask a Question