Our Products:   CompleteFTP  edtFTPnet/Free  edtFTPnet/PRO  edtFTPj/Free  edtFTPj/PRO
+1 vote
1.6k views
in CompleteFTP by
Hi,

I'm currently looking into making the process of creating accounts a little easier & have briefly looked into scripting, but am a bit confused about how we can transfer variables from powershell into the enterprise editions command line via SSH.

All of the accounts we create have two users with their three letter abbreviation followed by either .more2 for internal use or .user for external use. I would like to set it up so that the only characters a user has to enter while running the script is the three letter abbreviation & the script will create the rest.

Do you have any ideas on how to achieve this?

1 Answer

0 votes
by (162k points)

Powershell now includes an SSH client, so you can ssh to the Admin site as described here and run commands such as useradd

by (51.6k points)
Please check the log file for compile errors.  The log file is at:
C:\ProgramData\Enterprise Distributed Technologies\CompleteFTP\Logs\Diagnostics.log

Your script yielded the following error:

  JSS compile error: no viable alternative at input 'var' (line 6, column 5)

This error is happening because you should be using forward slashes instead of backslashes.

Another couple of points:
1. there's no need to get the Group object, using config.groups.get, as you're really just using the name
2. the permissions need to be set to an array of strings with one permission per string.
3. you don't need to put quotes around the group name when you invoke the command
4. it's a good idea to check if the folder was found, so I've added code to do that

Please try the following script.

function groupfolderperm(groupName) {
    var config = system.getConfig();
    var fullpath = "/home/" + groupName;
    var folder = config.folders.get(fullpath);
    if (!folder)
        throw "Could not find folder, " + fullpath;
    folder.access.group.groupName = groupName;
    folder.access.group.permissions = [ "FileRead", "FileWrite", "FileAppend", "FileRename", "FileDelete", "FileExecute", "DirList" ];
    config.applyChanges();
}

I've tested it and it works for me.
by (100 points)
Thanks so much, I'm definitely not in anyway a developer so you're really helping me understand what seems to be some basic JSS concepts here haha!

That seems to be working, but the virtual file path can not be found:

  command 'groupperm TESTGROUP' failed: Could not find folder,  /home/TESTGROUP

This exists in the windows file system as:

D:\FTPData\Users\TESTFOLDER

Is this because of our filestructure within completeFTP?

Currently, we don't have our windows file system within a virtual folder, it is in the root within completeFTP & is called home - do we need to put this within a virtual folder & do you know if that'll break any current functionality?

Thanks,
Johnny
by (51.6k points)
Yes, that script operates only on the permissions within the virtual file-system. It doesn't change Windows permissions.
by (100 points)
Hi,

Can we leave the current file structure alone (we don't want to break this, as it is a production server) & just create a new virtual folder & then add the current windows folder into that? So we have a windows folder with all of the clients folder & a virtual folder with the windows folder & all of the clients?

Thanks,
Johnny
by (51.6k points)
Just to make sure I'm understanding you correctly:

Your Windows file structure is like this:

C:\A\B
C:\A\B\C

Currently you have only B mapped into the CompleteFTP Virtual File-System (VFS), so it just look like this:

/B

But you want to use CompleteFTP permissions to control access to C:\A\B\C, so you therefore want to add C to the VFS, so that it becomes:

/B
/B/C

thus allowing you to set the permissions of C in the VFS.

If that's what you mean then yes, you can do that. Just keep in mind that, by default, the permissions of Windows users in CompleteFTP are NOT controlled by CompleteFTP, so if you want to control permissions of Windows users from CompleteFTP then you need to set the Access Control property of your Windows users to Non-Windows.

Categories

...