[SOLVED] Linux to Windows sharing WITHOUT manual password entry
Linux - NewbieThis Linux forum is for members that are new to Linux.
Just starting out and have a question?
If it is not in the man pages or the how-to's this is the place!
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
Linux to Windows sharing WITHOUT manual password entry
I have been trying for weeks now to be able to transfer files from Linux to Windows with minimal success. I already have a Powershell script created that grabs files from a Linux directory but I want to have a bash script to do this instead. In my Powershell script it uses a host key right in the script. I want to insert the host key in a bash script too. So since it works in Powershell, I figured when I created a bash script it would not ask for a password because of the previous use of this authentication, but it still asks for a password. I want the process to be fully automated.
passwords, it is coming and going. It wouldn't matter if you psychically log in you have to enter a password regardless of which system you're logging into.
Same with scripts. The thing you could do is insert the password within your script to be entered each time, or set it up so no password is actually needed to preform this task.
set it up for auto authentication with some type of hash code.
think of how Bluetooth works it has a trusted certificate, so when that same phone is connected it is automatically allowed access.
each device holds this record. the pc and the phone both know each other and was given a trust account. No password is needed.
Can you please show me how to do this, with and without a password. Smbclient looks promising. I looked at everything from smbclient, scp, sftp, etc and have got nowhere
Can you please show me how to do this, with and without a password. Smbclient looks promising. I looked at everything from smbclient, scp, sftp, etc and have got nowhere
Putting "how to map a windows share in linux" into Google pulls up many examples. This one:
...uses the built-in CIFS file system and the existing mount command to mount a Windows share to a folder in Linux. Replace variables with what matches your Windows server/user/password/share and the desired folder for Linux. Don't want to put the password in the script? Then just delete the ",password=somepassword" from the above command. It'll then prompt you for a password.
The easiest would be to mount a windows share using fstab with a credentials file as shown above. You can then transfer files using the cp command.
There are other methods like using expect or heredoc but for services other then windows file sharing you will need to install a server (sftp, ftp etc) on the Windows PC.
Did you create a share for the desired directory? I did have to review the man pages for smbclient and it also can use a credentials file using the -A option.
The credentials file format is:
username = mywinuser
password = mywinpass
You can specify the password and username on the command line.
smbclient defaults to the clients username i.e. who you are logged in as. It depends how you created the share on the windows box (allows users and password). You need to use the windows username via the -U option.
@michaelk..........I tried what you suggested, put the password in and get Error NT_STATUS_UNSUCCESSFUL. I even did -U username%password, that didn't even work 8.((
What version of windows are you running? The linux username/password is not necessarily the same as the windows username/password. With WinSCP you are using your linux credentials, with smbclient you are using the windows credentials.
Assuming your not running a domain, LDAP or AD authentication etc.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.