I need to get file list from samba share using smbclient (mount is not allowed for several reasons) and later download some of them;

When I execute the command

 smbclient -U my_username \\\\server_address\\somedir my_password -с "tarmode;recurse;prompt; mget *"

everything is ok - it downloads files and gets back to my usual console session. But when I execute the following

 smbclient -U my_username \\\\server_address\\somedir my_password -с "ls"

it does not execute ls - it just logs in and shows me the smbclient console.What I am doing wrong?


ls is not a valid smbclient command.

You could change that ls to a dir or you can precede it with a ! as !ls to issue it as a shell command via smbclient.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.