LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Server
User Name
Password
Linux - Server This forum is for the discussion of Linux Software used in a server related context.

Notices


Reply
  Search this Thread
Old 02-28-2007, 04:25 PM   #1
Bogdan
Member
 
Registered: May 2001
Location: Belarus
Distribution: Debian
Posts: 120

Rep: Reputation: 15
Disk quota for 'virtual' user


Hi I use proftp with virtual users stored in mysql. After user login, proftpd create files with virtual user UID, that does not exist in /etc/passwd.

When I do:
quotatool -b -l 10MB -u 10014 /home/
I get:
quotatool: User 10014 does not exist

How could It be fixed? AFAIK kernel use only numeric UID's... Why it is not possible to set quota for uid?
 
Old 02-28-2007, 05:58 PM   #2
Brian1
LQ Guru
 
Registered: Jan 2003
Location: Seymour, Indiana
Distribution: Distribution: RHEL 5 with Pieces of this and that. Kernel 2.6.23.1, KDE 3.5.8 and KDE 4.0 beta, Plu
Posts: 5,700

Rep: Reputation: 65
Did a quick search for ' quota control virtual user ' on Google and the first link was this.
http://linuxcult.blogspot.com/2006/0...and-mysql.html

Also might check this out. Not sure if it will help.
http://souptonuts.sourceforge.net/quota_tutorial.html

Brian
 
Old 03-01-2007, 02:02 AM   #3
Bogdan
Member
 
Registered: May 2001
Location: Belarus
Distribution: Debian
Posts: 120

Original Poster
Rep: Reputation: 15
Brian1 -
1st link is common firt-line-of-google-stuff. Proftpd support transfer quotas, no storage. And I use them now.
2nd link seems to be usefull, at least I'll have to write my own quota tool thanx
I'll try to remove
Code:
  if ((pwd = getpwnam(user)) == NULL) {
           printf(stderr, "Invalid -u option \n");
           exit(1);
       }
Or so from quotatool sources.
 
Old 03-01-2007, 07:06 AM   #4
Bogdan
Member
 
Registered: May 2001
Location: Belarus
Distribution: Debian
Posts: 120

Original Poster
Rep: Reputation: 15
I modify system.c in quotatool-1.4.9
Code:
uid_t system_getuid (char *user) {
  struct passwd *pwent;
  int uid;
  char *temp_str;
  /* seach by name first */
   pwent = getpwnam (user);

   if ( pwent == NULL ) {

     /* maybe we were given a numerical id */
     uid = strtol(user, &temp_str, 10);
     pwent = getpwuid ((uid_t) uid);
/*     if ( (user == temp_str) || ( pwent == NULL ) ) { */
        if ( user == temp_str ) {
       output_error ("User %s does not exist\n", user);
       return -1;
     }
     return uid;
   }
   output_info ("user '%s' has uid %d", user, pwent->pw_uid);
   return (pwent->pw_uid);
}
And now it does not check /etc/passwd if numerical uid was passed.
Seems to work for me.
 
  


Reply

Tags
mysql, proftpd, quota, user, virtual



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Virtual Hard disk detection for Single User Mode adeelenter Linux - Hardware 3 01-31-2007 01:32 AM
Where can I find a simple tutorial on quota (limit capacity of disk space of a user)? George2 Linux - Software 5 11-04-2003 08:56 AM
how do i set a user disk quota axis Linux - Security 5 09-01-2003 10:33 PM
Limit Disk Quota per user ? mikeshn Linux - General 1 06-19-2003 06:33 PM
Disk Quota for user and group ??? sultan Linux - General 0 05-13-2002 06:37 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Server

All times are GMT -5. The time now is 04:40 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration