As I understand smbclient
shell does not support grep
and io redirection. But you can just mount your samba share to local file system and use all features of bash shell.
You need to install cifs-utils.
$ sudo apt-get install cifs-utils
Now you should be able to mount samba share. Here is example
$ mount.cifs //192.168.1.1/share_point /path_to_your/local/folder -o user,uid=1000,rw,workgroup=DEV,credentials=/path_to_credentials/.cifs
You have to create /path_to_your/local/folder
$ mkdir /mnt/my_share
and credentials file. I suggest to create folder crd
in your $HOME
, change permission to 700
.
$ mkdir ~/crd
$ chmod 700 ~/crd
Now in $HOME/crd
create .cifs
file with this content:
username=value
password=value
domain=value
Change permission to this file to 600
.
$ chmod 600 ~/crd/.cifs
Now you only need to substitute IP address:
$ mount.cifs //192.168.1.1/share_point /mnt/my_share -o user,uid=1000,rw,workgroup=DEV,credentials=$HOME/.cifs
You may also want this mount to be mounted on boot automatically. Add this to your /etc/fstab
, at the end
//192.168.1.1/share /mnt/my_share cifs uid=1000,credentials=$HOME/.cifs,iocharset=utf8,sec=ntlm,noauto,user 0 0
Don't forget to substitute $HOME with your home folder, and IP address with appropriate IP.
Sources
mount.cifs man
About smbmount
About fstab and smb mount