HowTo_Userless_folder.pdf

(198 KB) Pobierz
HowTo create Windows File Sharing (SMB/CIFS) folder
without a user or a password on the FSG
This is a HowTo create a folder on the FSG that can be accessed without a username and
password. If you wish to have a folder without a password only but with a username, you
can simply leave the password fields empty.
Please be aware this method creates a huge security hole. It basically switches
security off.
Switch on SSH
Go to the configuration pages of your FSG
o
Start your FSGA
Press “Search again”
Double click on the found FSG
Your browser will open with the login page
If you have encryption (SSL) enabled in the configuration pages,
please remember to add an “s” to http. So the URL should look
like
https://ip_of_your_FSG
or
https://fsg
in your browser window
o
In the login page, press “Enter configuration”
In the configuration pages, switch on the SSH server
o
Go to “Services/SSH server”
o
Select “Run SSH…” and “Open to …”
o
Press Apply
Login as root to the command shell
Use your favorite SSH client to access the FSG
o
Putty
for instance
http://www.putty.nl/download.html
Use the
putty
documentation to find out how to reach the FSG. It comes down to:
o
Type in the IP address or name of the FSG
o
Make sure SSH is selected
When Putty connects, you will see a text based interface (command Line Interface
or CLI)
Login as user admin
You are now in a full unix shell, with a lot of commands the unix shell has. For more info
you can read:
http://www.busybox.net/downloads/BusyBox.html
Some common commands:
cp -> copy files (see cp --help)
cd -> change directory (see cd -- help)
Freecom Technologies GmbH copyright 2006
Page 1 of 4
ls -> list folder names (see ls --help, similar to dir/w on Dos) Also try “ls -l” for a full
listing including owners and rights
pwd -> show folder name of current folder (see pwd --help)
mv -> move files (see mv --help)
find -> find files (see find --help)
rm -> remove files (see rm --help)
Use with caution!!!
There is no undelete.
chmod -> change permission of files (see chmod --help)
chown -> change owner of files (see chown --help)
vi -> edit files (see
http://www.cs.colostate.edu/helpdocs/vi.html
for the manual)
<tab> -> finishes a filename or folder name for you
Now login as root
o
For root type "su" <enter> on the CLI
o
Password is "loginasrootisrisky" or for older FSGs "fhd3lan"
o
You are now root. Change your password to be safe with “passwd”.
Be Aware!!!!!!!
You can really destroy your FSG using root. You have access to the entire machine, so
also to for instance the red boot. This is the flash chip based startup code which loads the
FSG firmware at startup. Without this code, your FSG is dead, and most likely the entire
chip will have to be replaced. As this will have been your own doing, Freecom will not
give you warranty for this. Root gives a lot of power and with great power comes great
responsibility.
Create a folder
First create a folder under the /home tree
o
Type “cd
/home”
<enter>
o
Type “mkdir
folder_name”
<enter>
I will use “folder” as my example folder name. For a different name, change all instances
of the word “folder” in below commands
Now set the rights and owner of the folder
o
Type “chmod
admin.nobody folder”
<enter>
o
Type “chmod
774 folder”
<enter>
o
Type “ls
-l”
<enter> and check that the owner and rights are correct:
drwxrwxr-- 2 admin nobody
48 Mar 23 12:38 folder
Samba configuration settings
Go to /etc/init.d
o
Type “cd
/etc/init.d”
<enter>
Open the samba configuration file and make changes
o
Type “vi
samba”
<enter>
Freecom Technologies GmbH copyright 2006
Page 2 of 4
o
In the Global settings at the top of the file, change
"security=user\n"\
to
"security=share\n"\
Using the vi command “i” for insert and the backspace to delete when in
inert mode. You can go out of insert mode by hitting the <Esc> button.
o
After the
for FOLDER in $(grep "^dir=" /etc/master.conf | cut -d= -f2-); do
NAME=$(echo "$FOLDER" | cut -d# -f1)
USER=$(echo "$FOLDER" | cut -d# -f2-)
USER=$(echo "$USER" | sed -e "s;#; ;g")
echo -e "\n[$NAME]\n"\
"path=/home/$NAME\n"\
"read only=no\n"\
"create mode=0666\n"\
"force create mode=0666\n"\
"directory mode=0777\n"\
"force directory mode=0777\n"\
"browseable=yes\n"\
"valid users=admin $USER \n" >> /usr/local/samba/lib/smb.conf
Done
and before the
/usr/local/samba/bin/smbd
-D >/dev/null 2>&1
/usr/local/samba/bin/nmbd -D >/dev/null 2>&1
Insert the following text. Start Insert mode in vi by typing an “i” and stop the
insert again using <Esc>
Insert the following exactly. Please be aware Linux is Case Sensitive, so
beware of caps! (change foldername “folder” appropriately)
echo -e "\n[folder]\n"\
"comment=Folder access without username or password\n"\
"path=/home/folder\n"\
"browseable=Yes\n"\
"writable=Yes\n"\
"guest account=admin\n"\
"guest ok=Yes\n"\
"create mode=0666\n"\
"directory mode=0777\n"\ >> /usr/local/samba/lib/smb.conf
Leave vi
o
Type <Esc> “:wq”
o
You should be back on the command line now.
Restart samba
o
Type “cd /etc/init.d” <enter> (You should be there already)
o
Type “./samba stop” <enter>
Freecom Technologies GmbH copyright 2006
Page 3 of 4
o
Type “./samba start” <enter>
o
There should not be error messages
Connecting to the share
We have just created a shared folder without user or password. To connect to it from your
windows PC, just use the latest FSGA as you are used to. It will show the folders without
asking for a username or password. You can also use the build in windows tools if you
prefer.
Freecom Technologies GmbH copyright 2006
Page 4 of 4
Zgłoś jeśli naruszono regulamin