Command adduser don't add ftp-user to WebGUI

Status
Not open for further replies.

alexgl

Dabbler
Joined
Jul 24, 2013
Messages
10
Command adduser don't add ftp-user to WebGUI.
Which command or parametr can add user to WebGUI?
This is code for:
Code:
echo "$user::14::::FTP user $user:$base/$user:/bin/csh:$password"|adduser -f - >> $base/make_users.log;

Help, please.
 

cyberjock

Inactive Account
Joined
Mar 25, 2012
Messages
19,525
You are correct. You must add users from the Web UI to have those users be option in the Web UI. This is because FreeNAS tracks the users based on your creation and deletion from the UI. If you create users(or delete users) from the command line FreeNAS won't know.
 

alexgl

Dabbler
Joined
Jul 24, 2013
Messages
10
I desided make this:
Code:
    this_id=$(sqlite3 /data/freenas-v1.db "SELECT MAX(id) FROM account_bsdusers;");
    m=$(sqlite3 /data/freenas-v1.db "SELECT bsdusr_uid FROM account_bsdusers WHERE id = $this_id;");
    ((m = m + 1));
    $(sqlite3 /data/freenas-v1.db "INSERT INTO account_bsdusers ('bsdusr_email','bsdusr_full_name','bsdusr_password_disabled','bsdusr_locked','bsdusr_username','bsdusr_group_id','bsdusr_uid','bsdusr_unixhash','bsdusr_shell','bsdusr_builtin','bsdusr_home','bsdusr_smbhash') VALUES ('','$user',0,0,'$user',12,$m,'','/bin/csh',0,'/mnt/fortest/$user','');");

but...is there command or functions in freenas which make hash for fields bsdusr_unixhash and bsdusr_smbhash?
 

alexgl

Dabbler
Joined
Jul 24, 2013
Messages
10
It's works. I'm looking for other tables where i must make changes, but for only showing in GUI that's enough. if I want change permissions I can make it from GUI. When I save in GUI hash generate.
 

alexgl

Dabbler
Joined
Jul 24, 2013
Messages
10
You are correct. You must add users from the Web UI to have those users be option in the Web UI. This is because FreeNAS tracks the users based on your creation and deletion from the UI. If you create users(or delete users) from the command line FreeNAS won't know.
Is the hash generate in python?
 

pirateghost

Unintelligible Geek
Joined
Feb 29, 2012
Messages
4,219
Is there something wrong with the web GUI?

Sent from my Galaxy Nexus
 

cyberjock

Inactive Account
Joined
Mar 25, 2012
Messages
19,525
Is there something wrong with the web GUI?

Sent from my Galaxy Nexus

I was going to ask the same thing. The WebGUI really should be used for anything that it can do. The CLI is only meant for advanced users that want to use features that aren't available from the Web GUI. And only then with extreme caution. A bunch of stuff on FreeNAS is auto-compiled on bootup, so alot of customizing you can do from the CLI will disappear on reboot.
 

alexgl

Dabbler
Joined
Jul 24, 2013
Messages
10
Is there something wrong with the web GUI?

Sent from my Galaxy Nexus
no-no-no.

I need make cronjob, which get text file with names of users, and make ftp-users and folders for them.

I make it, but ftp-users don't add to webGUI.

I found the solution described above, but for complete task, I need generate unixhash and smbhash....thinking.

You have any idea to that?
 

alexgl

Dabbler
Joined
Jul 24, 2013
Messages
10
Oops. After restart users, which generated by this reason, without passwords now.
Both hash to sqlite base needed for normal work.
 

cyberjock

Inactive Account
Joined
Mar 25, 2012
Messages
19,525
I hate to say it but I really think you're fighting an uphill battle. I don't think I've seen someone do what you are trying to do. But many people have wanted to create users from the CLI and as far as I know it never really worked out for them long-term.
 

alexgl

Dabbler
Joined
Jul 24, 2013
Messages
10
I have one more question
how i can run in bash $($base/unixhash2.py) with root?
Why I need it.
Code:
import os
import sys
 
user_come = str(os.environ['EXP_USER'])
pass_come = str(os.environ['EXP_PASS'])
path_come = str(os.environ['EXP_PATH'])
shell_come = str(os.environ['EXP_SHELL'])
#uid_come = int(os.environ['EXP_UID'])
gid_come = int(os.environ['EXP_GID'])
 
WW_PATH = "/usr/local/www"
FREENAS_PATH = os.path.join(WWW_PATH, "freenasUI")
 
sys.path.append(WWW_PATH)
sys.path.append(FREENAS_PATH)
 
os.environ["DJANGO_SETTINGS_MODULE"] = "freenasUI.settings"
 
#from django.db import models
 
from freenasUI.middleware import notifier
 
notifier_class = notifier.notifier()
 
notifier_class.user_create(user_come,user_come,pass_come,-1,gid_come,shell_come,path_come,False,False)


this code make error
Code:
Jul 25 12:59:31 freenas unixhash.py: [middleware.exceptions:38] [MiddlewareError: Operation could not be performed. pw: passwd file update: Inappropriate ioctl for device ]


I think it is because python from this command line don't have permissions to passwd file.
 

cyberjock

Inactive Account
Joined
Mar 25, 2012
Messages
19,525
I don't have an answer personally. FreeNAS does a lot of things to protect the user from doing things that may be "stupid" in the CLI and it could be that FreeNAS has some protection mechanism you are running into.
 

alexgl

Dabbler
Joined
Jul 24, 2013
Messages
10
I desided make this:
Code:
    this_id=$(sqlite3 /data/freenas-v1.db "SELECT MAX(id) FROM account_bsdusers;");
    m=$(sqlite3 /data/freenas-v1.db "SELECT bsdusr_uid FROM account_bsdusers WHERE id = $this_id;");
    ((m = m + 1));
    $(sqlite3 /data/freenas-v1.db "INSERT INTO account_bsdusers ('bsdusr_email','bsdusr_full_name','bsdusr_password_disabled','bsdusr_locked','bsdusr_username','bsdusr_group_id','bsdusr_uid','bsdusr_unixhash','bsdusr_shell','bsdusr_builtin','bsdusr_home','bsdusr_smbhash') VALUES ('','$user',0,0,'$user',12,$m,'','/bin/csh',0,'/mnt/fortest/$user','');");

but...is there command or functions in freenas which make hash for fields bsdusr_unixhash and bsdusr_smbhash?

it's enough.

All is work. Hashes not needed. My mistake was in creating folders - differents name of folder and record to base.
Users stay after restart, passwords work correctly.
 

alexgl

Dabbler
Joined
Jul 24, 2013
Messages
10
I don't have an answer personally. FreeNAS does a lot of things to protect the user from doing things that may be "stupid" in the CLI and it could be that FreeNAS has some protection mechanism you are running into.
I found, how I can drop freenas with using one bash command, if I have any access to command_line. Very simple. If Interest mail to alexgl2004@gmail.com, because I can't write personal message to you on forum. This bug must be correct.
 
Status
Not open for further replies.
Top