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

  • SEARCH
  • Home
  • 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 986151
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T05:16:30+00:00 2026-05-16T05:16:30+00:00

I would like to build a program which takes a username as parameter and

  • 0

I would like to build a program which takes a username as parameter and creates the user and its home folder (with some hard-coded specifications like folder, and security checks like username cannot be root or an existing user).

My application needs to create users in order to give SSH access.

The program will be executed using sudo. I’ve read it should be written in C or C++ instead of scripts because scripts could easily be exploited.

  • Can you give me some advices or good practices about how to achieve this?
  • Should I use some Pam library? Is there any examples?
  • What are the possible security flaws?

I know C/C++, and running Ubuntu Lucid.

Edit:

The user will only have sudo access to run that specific command, I do not want it to be able to run a shell or bypass some programs (by changing PATH environment, for example).

As a result, for example, I will need to override the PATH, what else should I worry about?

  • 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-05-16T05:16:30+00:00Added an answer on May 16, 2026 at 5:16 am

    Probably your best bet is to invoke useradd; it will do the right things (given appropriate parameters).

    Trying to create one manually by calling the appropriate APIs is possible but not desirable.

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

Sidebar

Related Questions

I would like to build some code which calls some code on loadup of
I would like to build a program which lets lyrics of a song run
I'm writing a C++ program for which I would like to use some functionality
I would like to build an excel VBA program to find all the match
I would like to build a cypher with python which decoding text by repeatedly
I would like to build a jar file with eclipse, but the program seems
I have a C console program in VS2010 that I would like to edit/debug/build
I have a Java program using AWT which I would like to run on
In a Phing build file, I would like to invoke an external program (
I would like to build a php script that automatically generates a new id

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.