Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8565393
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T17:25:01+00:00 2026-06-11T17:25:01+00:00

I have a .sh file (lets say adduser.sh) that is executed via a cronjob

  • 0

I have a .sh file (lets say adduser.sh) that is executed via a cronjob that contains the commands to create an FTP user.

The adduser.sh file looks like so…

#!/bin/bash
mkdir /var/www/vhosts/domain/path;
useradd -d /var/www/vhosts/domain/path -ou <uid> -g <group> -s /bin/false <username>;
echo <password> | passwd <username> --stdin;

Now here is my problem. If I run it directly through SSH using…

sh adduser.sh

…no problems and it works as intended.

But if I let the cronjob run it the directory is created but the user is not added.

What gives?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-11T17:25:02+00:00Added an answer on June 11, 2026 at 5:25 pm

    I have resolved this simply adding /usr/bin/ to the useradd function.

    #!/bin/bash
    mkdir /var/www/vhosts/domain/path;
    /usr/bin/useradd -d /var/www/vhosts/domain/path -ou <uid> -g <group> -s /bin/false <username>;
    echo <password> | passwd <username> --stdin;
    

    Thanks everyone for helping me get on the right track. Hope this helps someone out there.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

So lets say i have a php file that contains $title=Website | Categories; And
I have a file lets say c:\file1.txt that has an ADS file lets say
I have a header file, lets say Common.h, that is included in all of
Lets say I have 10 lines in a file. I have 2 parameters that
Lets say I have a .c file with some methods, and I create a
I have a php file that show the friends requests, lets say there are
Lets say i have a file name demo which contains an essay. how can
I have a file that contains SQL commands for the creation of a database.
lets say i have an xml file path.xml that goes like this: <paths> <path
I do have a file f1 which Contains some text lets say All is

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.