Copy to Windows hidden share

Hi,

I need to find a solution for backing up/transferring BACKUP (dump file) from AIX (specifically) to Windows 2012 Hidden Share.

The vendor says that he cannot do a copy from his system to hidden share because it requires a password...

Personally, I think that there should be a solution (probably simple). I am not a Unix expert but cannot believe that in 2017 the password for Windows hidden share could be an obstacle.

Currently, we have an awkward solution and using Backup to tape for this system. We need to be able to copy first to DISK.

I did a quick search and found a way to do it from Linux... (didn't look closely yet).

Want to ask forum for a pro solution for the question if exists.

Thanks.

Not an AIX man, but do you have / can you use smbclient on your AIX installation ?

You will have to provide a user / password to connect and copy file to windows, either directly or via files etc.

Hope that helps
Regards
Peasant.

What exactly did you find that works on Linux? Maybe we can help you implement equivalent functionality on an AIX system.

You might want to install the cifs filesets, if not already done and try it out.

Here are two pages from IBM about cifs:

  1. IBM Knowledge Center - SMBFS mounting

(scroll a bit down on the next one)
2. IBM How to export a share in Windows and mount the share on AIX using CIFS.

Hello,
first thanks to all for trying to help...

to Don Cragun:

here is a link to Linux instructions:

NOTE!:
My TrendMicro agent produce an Alert about blocking a further link from this site as malicious...
Most probably false positive... but just in case if you don't want to touch the link I copy- paste the text from the blog.

I don't manage the server (it is vendor's ). I will greatly appreciate if somebody can really test a copy to hidden share on Windows (2012) and provide the exact workaround/instruction...

Here is a quick suggestion from an another forum:
*********************************************************
I don't think the password is the problem. I think the admin just needs to escape the "$" in the hidden share with a backslash. e.g.

mount -t cifs //server/hiddenshare\$ -o username=adminUserName,password=myPassword /mnt/srvshare

*******************************************

and here is a text from the blog (from site with an alert)

Backup files from Linux to a Windows server
Ok, this may be my last disaster recovery and backup blog for a long time. As you can probably tell from the title this blog entry is all about keeping backup strategies as cheap as possible.
My strategy is to backup all of my Windows and Linux servers to one central Windows server that is running a Tivoli backup agent. All of my servers are hosted elsewhere, and since it costs $99.00 per server to backup I am getting the most for my money by only backing a single server to tape/SAN. However that single server carries all of the files that need to be remotely backed up to tape/SAN.
My earlier posts show how to backup the Windows servers:
Windows backup bat script using xcopy
Also, how to backup the Windows Domain Controller:
Backup Windows Domain Controller using NTBACKUP via cmd
And I also showed how to backup a Linux server to a local file:
Linux backup using CRON to local directory
Now I will show how I moved the files backed up on the Linux servers to the Windows server prior to tape/SAN backup. I have decided to use Samba and mount a directory pointing to a shared folder on the Windows server. Lets begin:
Create a share on the Windows server to use as your backup location.
Create a user to use this share, and give the user permissions to use it.
Pick, or create, a user that you�re going to use to backup the files. Log in as this user and type �id� to get the numeric ID of the user in the Linux OS. (You will need it later.)
Become �root�. (This will enable you to perform the next tasks without problems.)
Install samba and samba-client if they are not installed yet.

yum install samba
yum install samba-client

You will need to answer �y� to when prompted.
By default only the root user can mount or unmount a cifs, so we must open it to other users.

chmod 4755 /sbin/mount.cifs
chmod 4755 /sbin/umount.cifs

Now we need to make a directory to use as our mount point.

mkdir /mnt/sharename

To enable our desired user to mount and unmount this we need to assign ownership to that user. Changing permissions with chmod is not enough.

chown userfrom#1 /mnt/sharename

Now we need to edit the /etc/fstab file and add an entry. Replace the user ID of 500 with your user ID from #1. Replace sharename with your Windows share name. Replace WINDOWSHOST with your hostname or IP address. If you don�t know the shares run

smbclient -L WINDOWSHOST //WINDOWSHOST/sharename /mnt/sharename cifs credentials=/root/smblogin,uid=500,noauto,user 0 0

Create/Edit a file /root/smblogin and put the following two lines in it.

username=WINDOWS USERNAME
password=WINDOWS PASSWORD

Now we must give our user from #1 access to the file, but still protect it.

chown userfrom#1 /root/smblogin
chmod 600 /root/smblogin

If you have IPTABLES active on your server you will need to make sure to add a policy to allow OUTPUT port 445.
Log in as the user from #1
Try to mount the share:

mount /mnt/sharename
ls -la /mnt/sharename
umount /mnt/sharename

If that was successful you are now ready to write a script that will automate the moving of your backup files from the Linux to the Windows share. (Script/File = backup.sh)

#!/bin/sh
mount /mnt/sharename
*
cp -r /path/to/file.tar.gz /mnt/sharename/path/to/file.tar.gz
*
umount /mnt/sharename

Of course you can add this to the end of the file described in Linux backup using CRON to local directory which would create a complete solution for backing up files, then relocating them to a remote Windows server.
Next you will add an entry to the crontab of the user from #1 to happen automagically.

crontab -e -u userfrom#1

Enter this into the crontab.

# Backup at 1:00 A.M. every day. Call 'man 5 crontab' for more information
* 1 * * * /path/to/backup.sh

Now once this is all done you can rest a little bit easier knowing that your servers are backed up. Published by

I realize that I'm coming to this thread very late. I'm not an AIX man either but I've had a few confrontations with accessing MS-shares from Unix/Linux/whatever boxes. Before I post anymore, I must state that everything I write is purely generic Unix speak and NOT AIX specific.

  1. Usually, the MS admin creates a share (hidden or visible) with the Unix users username and password. Then the Unix/Linux user simply logs in and his password is transmitted to the MSbox to access the share.
  2. The Unix admin installs an SMB client and declares (adds) the specific Unix user as an SMB user.
  3. At this point you would expect a connection to the MS share to work BUT IT Doesn't. The reason is that the SMB password to be transmitted to the MSbox has to be hashed in (typically) '/var/smb/smbpasswd' but when you look in there, that users hashed record is not there. However, now the Unix box is aware that the user is an SMB client user, if the sysadmin (or the user themselves) resets that user's password with the 'passwd' command (even if it's set to what is was already), the hash will be put in '/var/smb/smbpasswd' file. It miraculously appears. Until that hash is in the smbpasswd file there isn't a hope in hell of it working.

As I said, this may or may not be relevant. Others subscribed to this thread may know better but I just thought I'd chip in with that.

Best of luck.

From all the above answers I understand that it is not a trivial task... and probably our AIX application vendor is right...
Since I asked the question about copying files from AIX to Windows HIDDEN share you are trying to give some advises...
Let me ask the question another way...
Finally, the goal is to have AIX files available for backing up by VEEAM. That currently backing up 100+ VMs servers from ESX to StoreOnce HP storage (backup to disk)...
I need to have AIX data on the same DISK Storage
I just got couple of ideas...

  1. I guess that there should not be a problem of automating file copy from AIX to LINUX
    VM. If this is not possible than I give UP :slight_smile:
  2. If the 1 is correct, than the problem is solved. I will have have a Linux VM on ESX containing AIX files that could be easily restored or pushed to Tape library for off site purposes.

Another thought...
is it possible to create a task that will run PSCP for transferring files from AIX to WINDOWS machine? I used this not once from Linux machines in the past. Remember that actually credentials were used.

It should not be pushed from AIX. I need to find a way to pull it may be from Windows or Linux machine.

May be better suggestion in this direction?

Thanks all.

I think we should first clear a few basic things, solutions should then be obvious:

1) When Windows says it is doing "TCP/IP" this is a half-lie: in fact it is using TCP/IP to transport NetBIOS packets (and NetBIOS-protocols) around. In fact, when you want to talk to a Windows system you need to be able to talk NetBIOS.

2) The file transfer protocol native to the TCP/IP stack is - who'd have guessed the name - FTP. This isn't used to day any more but its securified successors (SFTP, SCP, ...) are. Alas, Windows doesn't speak any of these out of the box, because - see above - it doesn't really understand TCP/IP.

3) The alternative to file transfer is file sharing - basically the possibiity to mount part of a certain systems file(-system)s at a remote system. The TCP/IPs standard protocol for this is NFS. Again, Windows won't (out of the box) understand it, because NetBIOS has a different file sharing protocol: SMB (and its successor CIFS).

Solutions:

A) Use a file transfer solution: you will need scp on one system and a running sshd on the other. You won't need passwords because you can exchange keys and establish trust between two host/user combinations. This should be relatively easy to do because most modern AIX systems run sshd anyway. You can check with

lssrc -s sshd

if it is active or not. The transfer can (on either side) be scripted with relatively little effort to automate it.

B) If you want to use a file sharing solution you need to make the systems understand each others languages. If you can install software on the AIX side you need SAMBA or something such to make AIX understand SMB/CIFS. Then you can mount Windows shares as part of the UNIX filesystem and by moving/copying files you can transfer them to the Windows side.

If you only can install software on the Windows side you need to get some NFS client software (i have no idea which one that could be, but there is sure something available). Then you need to switch on NFS services on the AIX (if not already running), check with

lssrc -g tcp

Notice that NFS exists in different versions and both V3 and V4 are common today. You need to define a so-called "export" (if unsure how to do it, do it with smitty nfs ): a part of the AIX filesystem which can then be mounted from the Windows side.

I hope this helps.

bakunin

2 Likes

extremly clear tovarisch (hope you speak russian :)), I do...) bakunin.

will add to the info for our vendor with the info provided by others.

You put in a b c way.

Thanks!

Sure will update the thread when the final solution will be working one.
The guy not in the office those days.

I am very much an AIX person - my iisues are that I an not a CIFS person, even though I have, over the years dealt with all these issues.

IMHO: from UNIX NFS is usually the most straightforward method of file transfer for general purpose.

If it is just one file that needs to move from AIX to XXX then I would look at something much simpler than NFS/CIFS (or any filesystem based transfer mechanism). Instead I would look at scp (secure and readily available) and/or rsync - aka think "file" transfer programs.

Hope this helps!

Michael

Ah - bakunin - I see there are two pages of posts and you already said above. Take this as an additional "like" for your previous post :wink: