A piggy bank of commands, fixes, succinct reviews, some mini articles and technical opinions from a (mostly) Perl developer.

Jump to

Quick reference

Showing posts with label samba. Show all posts
Showing posts with label samba. Show all posts

Why doesn't smbclient work?

Symptoms:
You can mount a NetApp 'shared drive' using the mount program fine.
But if you try to browse it using smbclient, you get this error when it fails to connect:
session setup failed: NT_STATUS_MORE_PROCESSING_REQUIRED

Cause:
A bug in Ubuntu 11.04

Workaround:
Change your hostname to a short string, without any hypens (dashes) in it!

(copy)

smbclient commands on linux

# List all shares
smbclient -L '\\\\server-name' -U username -W DOMAIN

# Logs into server to type commands
smbclient '//server-name/sharename$' -U username -W DOMAIN

# Logs in, runs 'ls' command and disconnects

smbclient '//server-name/sharename$' -U username -W DOMAIN -c ls

# Other parameters:
-d99 = debug output
-D directory = start from directory

# Commands
get = just like FTP



See also smb2www (perl) and smb2www (c).


Edit text files on remote linux servers

UNTESTED:

> I've never managed to figure out how to rig up editors to edit
> files on remote servers.

On the server, put this in smb.conf

[homes]
comment = Home Directories
hide dot files = yes
read only = No
browseable = yes


Then in the finder/windows explorer connect to 'smb://hostname/' . Then make an alias to it on your desktop.

Alternatively, TextWrangler on the Mac has an ftp/sftp browser.

http://www.barebones.com/products/TextWrangler/

mount a directory from another host

in /etc/fstab:
//example.com/inetpub2 /nolmcs02/inetpub smbfs credentials=/root/nolmcs2-auth.txt,domain=NATIONAL,uid=noladmin,gid=noladmin,directio,hard 0 0

where /root/nolmcs2-auth.txt (or whatever you name it) is a file containing the username and password to use:

[root@nolappsdc01 ~]# cat /root/nolmcs2-auth.txt
username=
password=

You can mount this manually to test using:

mount -t smbfs //example.com/inetpub2 /nolmcs02/inetpub2 -o credentials=/root/nolmcs2-auth.txt,domain=NATIONAL,uid=noladmin,gid=noladmin,directio,hard

The credentials file is used so it will work on restart automatically. Instead of credentials=, you can use username=, etc. temporarily.