Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
[HOWTO] Windows access NAS directory right from samba share
#1
Idea Object :
From windows Explorer, while exploring some NAS shares, with a right click, access to the NAS matching directory with a Putty window. You will be logged with root user, or the one of your choice.
It's something I use quite often, so I guess it can be usefull to share.

:ugeek: Who is it for ?
People with windows 2k / XP / 2k3 / Seven / 2k8 / 8 and a minimum background on editing batch and registry files

:?: What for ?
- bunch of files managing with recursive rename, find, chmod, chown or rm commands as an example.
- doing automated and scripted operations on files or directories in seconds
- the power of Bash and the Windows comfortable GUI altogether
- recursive operations from the Explorer through a network share can take centuries, you know that. Doing it directly on the NAS filesystem is the best option
- for those like me, who (still) doesn't like to work with KDE or Gnome
- for those like me, who (sometimes) mess up with file rights and have too many shares
- 10% off !

Obviously, you can have permanent Putty windows open at the same time, w/wo PuttyCM, or be working with a Linux distrib already, that's not the point. The idea is to pushd the directory you're clicking on, directly in a bash window that will catch focus. Because you're in computers and, as a consequence, you are lazy, always looking for the shortest path to achieve yar goals, ah!
It's possible to do this with Linux also, using a simple parametric shell in the left click menu, almost I guess.

What it does:
[Image: srfq.png]

Arrow PRE-REQUISITES:
- [Image: putty.gif] Putty suite containing :
---- [Image: ico_pscp.png] pscp to copy files by SSH
---- [Image: puttygen.png] PuTTYgen if you don't already have a private SSH key
---- [Image: Pageant.png] pageant with preloaded private key
- some Windows ported GNU commands you can find easily such as gnuwin32.sourceforge.net or just busybox
- for your convenience, an editor such as Notepad++ or Notepad2.exe
- a place for your shells, where you put this one that you will edit later: goTo_N5550.cmd (rename it according to your NAS)
- at last one working samba shares from your NAS connected as a local drive with a letter:

Arrow Procedure on Windows:
1) get the path to your windows scripts, lets say "C:\path_to_your_scripts\" as an example
2) extract the following file in:
3) modify the Customizable section in goTo_n5550.cmd
3b) rename goTo_n5550.cmd according to your NAS name
4) modify the path the and the renamed goTo_n5550.cmd batch in goTo_n5550.shell_action.reg, + load it to the registry
5) modify the goTo_n5550.Putty.reg registry file (it's a Putty session) with:
+ any occurence of "N5550"
- you can also change "root" by the user of your choice
+ then load it to the registry
6) Do you have your own private key already and is it loaded with PuttyAgent ? If not, you can find many howtos on the web... Without a preloaded private key and the public key set in the user's authorized_keys file, you will be asked your password at each connection to your NAS, which is quite annoying.
7) (option) install the DejaVuSansMono_0.ttf font, it will be used by the Putty session (my favorite mono font)

Arrow Procedure on your NAS:
1) have you already set your user's rsa ssh key? If not, you can find many howtos on the web...
Anyway the command is
Code:
/opt/openssh/bin/ssh-keygen -t rsa
2) go to your user home (eg, /root) then add your public key in the /root/.ssh/authorized_keys file (create if needed)

:!: Now the first try!
1) open a Putty session to your NAS then forget it
2) back to the Explorer, try the right click on a subdirectory of your choice and goto your NAS link as in the first pic
3) depending on your installation, you will eventually be asked your password. A first MS-DOS window should appear or not (It's the pscp copy of the generated bash script to /tmp/)
4) a Putty window should appear and throw an error, which is normal
5) go back to the first Putty window you oppened, then type
Code:
chmod 755 /tmp/goTo.sh
6) close everything and retry (2) !!!

Idea How does it work ?
a) right click on a folder -> shell action goTo_NAS -> call to a batch with your directory as parameter
b) generation of a bash script with 2 lines of code:
Code:
cd /raid/data/{your/own/directory}
bash --init-file /root/.profile
c) ssh copy of this file to /tmp/
d) calling a Putty session with "root" user to your NAS then executing this script
e) the script will leaves you to the good directory in interactive mode

et voila
scavenger
N5550 V2.05.08.20150416.cdv + 4G patch
2*4GB Corsair CMSO8GX3M2A1333C9 = 8GB RAM
5 x 2To Hitashi HDS72202 (RAID5) @ write=72MB/s - read=91MB/s (802.3ad dual cable)
Reply
#2
[reserved]
scavenger
N5550 V2.05.08.20150416.cdv + 4G patch
2*4GB Corsair CMSO8GX3M2A1333C9 = 8GB RAM
5 x 2To Hitashi HDS72202 (RAID5) @ write=72MB/s - read=91MB/s (802.3ad dual cable)
Reply
#3
Take a look at my post (Steps 4 and 5) in:
[HOWTO] Remote Wake, Reboot and Shutdown

Can Bitvise SSH Client address some of your requirements? Certainly for my low level needs, it has some very handy features.
Thecus N5550 (D2550 @ 1.86GHz, BIOS: CDV_T29 X64)
Disks: 5*3TB RAID-6 (5 * Western Digital Red WDC WD30EFRX-68AX9N0)
Memory: 4GB (2*2GB Kingston KVR1333D3S8S9/2G)
OS: CentOS v7.3 (1611)
Reply
#4
Take a look at my post (Steps 4 and 5) in:
[HOWTO] Remote Wake, Reboot and Shutdown

Can Bitvise SSH Client address some of your requirements? Certainly for my low level needs, it has some very handy features.
Thecus N5550 (D2550 @ 1.86GHz, BIOS: CDV_T29 X64)
Disks: 5*3TB RAID-6 (5 * Western Digital Red WDC WD30EFRX-68AX9N0)
Memory: 4GB (2*2GB Kingston KVR1333D3S8S9/2G)
OS: CentOS v7.3 (1611)
Reply


Possibly Related Threads...
Thread Author Replies Views Last Post
  [HOWTO] access samba share from windows seven scavenger 7 6,403 12-17-2013, 05:56 PM
Last Post: Qoolbox

Forum Jump:


Users browsing this thread: 1 Guest(s)