DSM-G600, DNS-3xx and NSA-220 Hack Forum

Unfortunately no one can be told what fun_plug is - you have to see it for yourself.

You are not logged in.

Announcement

#1 2007-11-21 15:38:22

WinchKing
Member
Registered: 2007-11-12
Posts: 5

Etch chroot write permission via FTP or samba

Hye,

I have a chroot Etch chroot write permission problem via FTP and samba. I searched google but did not find a solution yet.

I have a CH3SNAS with Fonz fun_plug 0.3 and Etch. When I make a SFTP connection to my CH3SNAS I am able to connect. I can read every directory on the hardisk, writing is something else. Outside the Etch directories I can also write. But once inside the Etch directories I am not able to write anymore. The same accounts for writing via samba
First I thought my userrights were not OK. At the lowest level I have a /etc/passwd and on the Etch level I also have a /etc/passwd. So on the Etch level I also added the same user and password as I login with SFTP, but still no improvement.
I asked a friend of mine who also has a CH3SNAS, but he also has the same problem. What do we do wrong? Is there someone who can help us out?

Offline

 

#2 2007-11-21 17:15:04

dkl
Member
From: Toulouse
Registered: 2007-06-16
Posts: 104

Re: Etch chroot write permission via FTP or samba

I would say that the problem *might* come from the shell you use (not sure...). You need to have /etc/passwd in your chrooted Etch, as you stated. What do you use as a shell in that case? I myself use SFTP on Etch, but for that purpose, I compiled "mySecureShell" (apt-get, .configure, make, etc...). And everything works fine with this. More over, MySecureShell does not allow the connected user to go outside his "home" directory (like FTP), which is fine.
  If this can help...

Offline

 

#3 2007-11-22 21:06:53

WinchKing
Member
Registered: 2007-11-12
Posts: 5

Re: Etch chroot write permission via FTP or samba

Thanks dkl for your reaction. Unfortunetly for me the problem is not solved.

I installed jailkit, scponly (http://dns323.kood.org/howto:securing_sftp) and mySecureShell (underneath) on my CH3SNAS, but the same problem exists. With jailkit users, scponly and mySecureShell users I am not able to login via SFTP via WinSCP. With the default user admin on my CH3SNAS I am able to read all directories, I have write permission outside the etch directories, but I do not have write permission in my Etch directories.

-----
<B>MySecureShell</B>
MySecureShell is an SFTP server that is based on OpenSSH and can be configured in many ways, e.g.
it has support for chrooting users into their homedirs or for limiting upload-/download bandwidths.
MySecureShell makes SFTP available for users that do not have shell access so that these users do
not have to use the insecure FTP protocol anymore.

1) MySecureShell has a few requirements, so we install these first:

apt-get install libssl0.9.7 ssh openssh-server

2) Afterwards, we download and install MySecureShell as follows:

wget http://downloads.sourceforge.net/mysecu … source.tgz

3) Extract MySecureShell

tar zxvf MySecureShell-0.95_source.tgz

4) Build MySecureShell

cd MySecureShell-0.95
./configure
make
make install

5) Install MySecureShell

./install.sh en

6) Add users
Before users can use SFTP with MySecureShell, we must change their shell to /bin/MySecureShell. For existing users (<existing user>), we can do it like this:

usermod -s /bin/MySecureShell <existing user>

In order to create a new user (<new user>) with the /bin/MySecureShell shell, use a command like this:

useradd -m -s /bin/MySecureShell <new user>

Specify a password for the new user like this:

passwd <new user>

7) Set up SFTP connection
Now you can open an SFTP client (like WinSCP or Filezilla for Windows, gFTP for Linux, Cyberduck for MacOS; a list of clients is available here: http://mysecureshell.sourceforge.net/fr/clients.html) and connect to the server. I'm using WinSCP here.

Fill in the hostname, username, and password; the Port number is 22 (as with SSH); as Protocol you can either select SFTP or SFTP (allow SCP fallback). Then click on the Login button:

This is a modified setup for DNS 323 or CH3SNAS based on the post 'Chrooted SFTP With MySecureShell On Debian Etch' (http://www.howtoforge.com/mysecureshell … ebian_etch).

Offline

 

#4 2007-11-23 17:44:09

dkl
Member
From: Toulouse
Registered: 2007-06-16
Posts: 104

Re: Etch chroot write permission via FTP or samba

Well, your installation of MySecureShell looks good. It did more or less the same here. Maybe something is wrong somewhere else?

You could check the following points from your internal network first:
1 - check that ssh is running on the DNS ("ps -edf | grep ssh" should show you the ssh deamon)
2 - check that you can connect to the DNS through ssh (without speaking about sftp): if you have any *nix computer, try "ssh <mylogin>@<mydns323>". This should at least ask for a password and maybe authentification for your computer. From windows, use Putty to open a session under ssh. If you use a login name for which MySecureShell is the shell, you will not have any prompt, but you should be able to check that the connection was OK. To be sure, try with a user with /bin/sh as a shell.
3 -  if 1 and 2 are OK (and only in that case), you should then be able to open a SFTP connection. From Windows, WinSCP works OK, I have had some trouble with a recent version of FileZilla (version 3 I think), but previous version (2.xx) worked OK. From Linux, gFtp should also do the job.

Good luck. Come back here if one of these points is NOK.

Offline

 

#5 2007-11-23 21:43:34

ditmar
Member
Registered: 2007-11-08
Posts: 5

Re: Etch chroot write permission via FTP or samba

I have this exact same problem I do not use SSH or anything like that.

I connect to my Network-Drive and get into the main folder of my HD. When I delete or move something there it goes flawlessly. However once I enter my /ETCH/ directory I do not have permission to delete any file...

Whats wrong here ?

Offline

 

#6 2007-11-26 14:32:11

dkl
Member
From: Toulouse
Registered: 2007-06-16
Posts: 104

Re: Etch chroot write permission via FTP or samba

Sorry, there might be a misunderstanding somewhere. The first message was related to SFTP ("When I make a SFTP connection to my CH3SNAS..."). SFTP runs over SSH, so first thing to do is to check if SSH runs OK. This was the reason of my answer.

If the problem appears outside of this context, this should be "simply" a problem of unix permissions. Then you must check who is the owner, etc... Caution, UID's in Chrooted Etch and initial D-Link OS are not the same: the begin with 1000 in one case, and 500 in the other case.

Offline

 

Board footer

Powered by PunBB
© Copyright 2002–2010 PunBB