Closed ghost closed 2 years ago
admins can login to the web admin UI and create users. Users can login with enabled protocols (SFTP,FTP,WebDAV etc..), please read the getting started guide and check your logs to understand why you get a permission denied error
@drakkan I found this issue thread by attempting the same admin login flow as the user who raised this issue. I am looking for a fully automated setup with sftpgo so that it may be used for integration testing. The way that you describe a solution to the problem here makes it seem that a user has to log into a web admin dashboard to create a user, and the new user logs into the admin dashboard to enable protocols. This unfortunately makes sftpgo far more difficult to automate for setup.
@Dowwie please don't mix things up. Admins login to WebAdmin UI and create users, users can login via SSH/FTP etc.
A default admin can be auto-created by defining env vars. If you want to create admins, users, groups etc. you can load initial data. So you can fully automate your setup. Please read the support policy and don't ask for step-by-step support. Thank you
For anyone else who finds this thread and is looking for step-by-step, you may find the following useful.
First, set three environment variables:
When you start the sftpgo server with these env vars set, you want to create an access token as the admin and then use it to create users. Here's an example. You'll still have to familiarize yourself with the config variables and env vars beyond the scope of this working example (as of this comment).
BASE_URL="localhost:8080/api/v2"
TOKEN_URL="http://admin:password@${BASE_URL}/token"
RESPONSE=$(curl -s --show-error ${TOKEN_URL})
TOKEN=$(
echo ${RESPONSE} \
| jq ".access_token" \
| sed 's/^"\(.*\)"$/\1/'
)
curl --request POST \
--url ${BASE_URL}/users \
--header "Authorization: Bearer ${TOKEN}" \
--header "Content-Type: application/json; charset=utf-8" \
--data '{
"id": 1,
"status": 1,
"username": "ftp_user",
"email": "user@sftpgorules.com,
"description": "our ftp user",
"password": "myvoiceismypassport",
"public_keys": [
"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIIicEc0BRKRjehOp+OLRguWL7ntujkITtI7VYU70xbqG john@doe.com"
],
"permissions": {
"/": [
"*"
]
}
}'
for more information about this REST api endpoint and the others: https://sftpgo.stoplight.io/docs/sftpgo/d9755a1cfd67c-add-user
my docker command is :
docker run --name some-sftpgo -p 7070:8080 -p 2022:2022 \ -e SFTPGO_DATA_PROVIDER__CREATE_DEFAULT_ADMIN=1 \ -e SFTPGO_DEFAULT_ADMIN_USERNAME=admin \ -e SFTPGO_DEFAULT_ADMIN_PASSWORD=123456\ -dit "drakkan/sftpgo:v2.3.5-alpine"
this is my log from docker started:then I use
sftp -P 2022 admin@localhost
typed password 123456 , it says permission denied ,try again . container logs says :then I go to web ui : http://localhost:7070/web/admin/login , I can login in by admin:123456.
after log in , I created an user (or admin ) account , then
sftp -P 2022 user@localhost
can log in and put or get file .And if I use rest api to create user by this step :
sftp -P 2022 user@localhost
says permission denied .