수백명의 사용자 등록 스크립트

dcmru의 이미지

안녕하세요. 테스트 목적으로 수백명의 사용자를 등록할일이 생겼느데,

스크립트 소스를 가지고 계시거나 아시는 분께서는 알려주세요.

비밀번호 설정까지 할 수 있었으면 합니다.

관련 소스를 찾아다니고 있으나 아직 검색력 부족인지 찾지를 못하고 있습니다.

아이디 등록시 단순한 아이디가 아닌 랜덤한 아이디와 비밀번호를 등록하는 방법이 있을까요?

물론 파일에 기록을 하던지 랜덤한 아이디에 대한 비밀번호는 알 수 있어야합니다.

그럼 수고하세요.

송효진의 이미지

/etc/ passwd, group, shadow 파일에 추가하기만 하면 되는겁니다.
/bin/passwd 는 키보드 입력만 받기 때문에, 짜기 귀찮고요, (찾으면 나오긴 합니다.)

php 의 crypt 함수가 기본적으로 md5 연동이 되어 shadow 에서 쓰는것과 같은 형식으로 나옵니다.
형식 맞춰서 직접 써 넣게 작성하면 가장 빠를겁니다.

emerge money

cjh의 이미지

adduser/useradd 프로그램을 사용하면 암호까지 명령행으로 지정할 수 있습니다.

랜덤 암호 생성은 http://packages.debian.org/stable/admin/makepasswd.html
이런걸 이용해 보세요.

--
익스펙토 페트로눔

--
익스펙토 페트로눔

dcmru의 이미지

답변감사드립니다.

찾다가 그냥 아이디는 숫자의 증가순으로 아이디를 만들어 버렸습니다.

패스워드를 변경해야하는데, 좀 더 찾아봐야겠군요.

useradd 옵션도 더 살펴봐야겠네요. ^^

노력만이 살길이다.

노력만이 살길이다.

묵검추의 이미지

#!/usr/bin/perl
 
srand time ;
for ( 0..300) {
        $id = sprintf("user%03d" , $_) ;
        $pwd = int rand(999999) ;
        print "$id:$pwd\n" ;
        @cmd = ( "adduser" , "-p" , crypt($pwd , "AA") , $id ) ;
        system @cmd ;
}

간단히 테스트 목적이면 이정도로도 충분하실듯..

댓글 달기

Filtered HTML

  • 텍스트에 BBCode 태그를 사용할 수 있습니다. URL은 자동으로 링크 됩니다.
  • 사용할 수 있는 HTML 태그: <p><div><span><br><a><em><strong><del><ins><b><i><u><s><pre><code><cite><blockquote><ul><ol><li><dl><dt><dd><table><tr><td><th><thead><tbody><h1><h2><h3><h4><h5><h6><img><embed><object><param><hr>
  • 다음 태그를 이용하여 소스 코드 구문 강조를 할 수 있습니다: <code>, <blockcode>, <apache>, <applescript>, <autoconf>, <awk>, <bash>, <c>, <cpp>, <css>, <diff>, <drupal5>, <drupal6>, <gdb>, <html>, <html5>, <java>, <javascript>, <ldif>, <lua>, <make>, <mysql>, <perl>, <perl6>, <php>, <pgsql>, <proftpd>, <python>, <reg>, <spec>, <ruby>. 지원하는 태그 형식: <foo>, [foo].
  • web 주소와/이메일 주소를 클릭할 수 있는 링크로 자동으로 바꿉니다.

BBCode

  • 텍스트에 BBCode 태그를 사용할 수 있습니다. URL은 자동으로 링크 됩니다.
  • 다음 태그를 이용하여 소스 코드 구문 강조를 할 수 있습니다: <code>, <blockcode>, <apache>, <applescript>, <autoconf>, <awk>, <bash>, <c>, <cpp>, <css>, <diff>, <drupal5>, <drupal6>, <gdb>, <html>, <html5>, <java>, <javascript>, <ldif>, <lua>, <make>, <mysql>, <perl>, <perl6>, <php>, <pgsql>, <proftpd>, <python>, <reg>, <spec>, <ruby>. 지원하는 태그 형식: <foo>, [foo].
  • 사용할 수 있는 HTML 태그: <p><div><span><br><a><em><strong><del><ins><b><i><u><s><pre><code><cite><blockquote><ul><ol><li><dl><dt><dd><table><tr><td><th><thead><tbody><h1><h2><h3><h4><h5><h6><img><embed><object><param>
  • web 주소와/이메일 주소를 클릭할 수 있는 링크로 자동으로 바꿉니다.

Textile

  • 다음 태그를 이용하여 소스 코드 구문 강조를 할 수 있습니다: <code>, <blockcode>, <apache>, <applescript>, <autoconf>, <awk>, <bash>, <c>, <cpp>, <css>, <diff>, <drupal5>, <drupal6>, <gdb>, <html>, <html5>, <java>, <javascript>, <ldif>, <lua>, <make>, <mysql>, <perl>, <perl6>, <php>, <pgsql>, <proftpd>, <python>, <reg>, <spec>, <ruby>. 지원하는 태그 형식: <foo>, [foo].
  • You can use Textile markup to format text.
  • 사용할 수 있는 HTML 태그: <p><div><span><br><a><em><strong><del><ins><b><i><u><s><pre><code><cite><blockquote><ul><ol><li><dl><dt><dd><table><tr><td><th><thead><tbody><h1><h2><h3><h4><h5><h6><img><embed><object><param><hr>

Markdown

  • 다음 태그를 이용하여 소스 코드 구문 강조를 할 수 있습니다: <code>, <blockcode>, <apache>, <applescript>, <autoconf>, <awk>, <bash>, <c>, <cpp>, <css>, <diff>, <drupal5>, <drupal6>, <gdb>, <html>, <html5>, <java>, <javascript>, <ldif>, <lua>, <make>, <mysql>, <perl>, <perl6>, <php>, <pgsql>, <proftpd>, <python>, <reg>, <spec>, <ruby>. 지원하는 태그 형식: <foo>, [foo].
  • Quick Tips:
    • Two or more spaces at a line's end = Line break
    • Double returns = Paragraph
    • *Single asterisks* or _single underscores_ = Emphasis
    • **Double** or __double__ = Strong
    • This is [a link](http://the.link.example.com "The optional title text")
    For complete details on the Markdown syntax, see the Markdown documentation and Markdown Extra documentation for tables, footnotes, and more.
  • web 주소와/이메일 주소를 클릭할 수 있는 링크로 자동으로 바꿉니다.
  • 사용할 수 있는 HTML 태그: <p><div><span><br><a><em><strong><del><ins><b><i><u><s><pre><code><cite><blockquote><ul><ol><li><dl><dt><dd><table><tr><td><th><thead><tbody><h1><h2><h3><h4><h5><h6><img><embed><object><param><hr>

Plain text

  • HTML 태그를 사용할 수 없습니다.
  • web 주소와/이메일 주소를 클릭할 수 있는 링크로 자동으로 바꿉니다.
  • 줄과 단락은 자동으로 분리됩니다.
댓글 첨부 파일
이 댓글에 이미지나 파일을 업로드 합니다.
파일 크기는 8 MB보다 작아야 합니다.
허용할 파일 형식: txt pdf doc xls gif jpg jpeg mp3 png rar zip.
CAPTCHA
이것은 자동으로 스팸을 올리는 것을 막기 위해서 제공됩니다.