Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Ideen zur idealen Benutzerverwaltung gesucht
View unanswered posts
View posts from last 24 hours
View posts from last 7 days

 
Reply to topic    Gentoo Forums Forum Index Deutsches Forum (German)
View previous topic :: View next topic  
Author Message
sarahb523
Guru
Guru


Joined: 10 Mar 2004
Posts: 423
Location: Berlin

PostPosted: Wed Jun 09, 2004 11:33 am    Post subject: Ideen zur idealen Benutzerverwaltung gesucht Reply with quote

Ich möchte meine wissen über benutzerverwaltung etwas erweitern und bei mir überhaupt mal sowas vernünftig einführen.

derzeitige lage:
2 hauptsächliche gruppen:
-user
-root

Alle Benutzer sind in user drin. Das Problem ist, das auch zwischen den usern daten ausgetauscht werden soll. D.h. es gibt ein /home/daten/share wo jeder machen kann was er will. Naja nicht ganz, da gibt's schon das erste problem:

erstellt ein user in /home/daten/share eine datei, so wird sie mit den rechten rw-r--r-- erstellt. Das ist normalerweise ok, aber eben nicht in diesem ordner. dort wäre per default rw-rw-r-- besser. Denn sonst kann niemand anderes auf die datei schreiben, da der sinn des share ordners ist, das eben alle lesend+schreiben drauf zugreifen können. Vor allem wenn der Ersteller der datei gerade nicht da ist und vergessen hat für die gruppe +w zu setzen gibt's probleme. Einige Benutzer haben sich selbst geholfen, da sie untereinader ihre Passwörter kennen. Allerdings wird dann auch das home des anderen als "share" mißbraucht, was ich eigentlich vermeiden möchte. Manche bei denen das zu oft passiert kennen auch das root pass, daher helfen die sich selbst.
wenn schon vorher feststeht das einige nutzer zusammen an einem projekt arbeiten wollen, dann arbeiten alle betreffenden user mit dem gleichen user (entweder ein neuer, nur für dieses projekt, oder ein account der teilnehmer)

Allem in allem ist die rechte verwaltung ziemlich sinnlos, da irgendwie alles durcheinader geht. Glücklicherweise kann ich den Benutzern vertrauen und daher ist das nur halb so schlimm, aber irgendwie würde ich das besser machen wollen.

Da ich verwalterin und besitzerin des system bin würde ich meinem user-account gern mehr rechte geben. Momentan darf ich das was die user auch können, aber ich würde die normalen rechte die ich jetzt habe + die rechte die die anderen user haben besitzen. Denn dann kann ich ein vergessenes g+w in share setzen ohne gleich root zu werden.

Ein weiteres Rechte Problem betrifft ssh. Ich würde gerne nur bestimmte benutzer erlauben sich einzuloggen, bzw. das einige benutzer sich nicht per ssh einloggen können.

Wie definiere ich eigentlich Benutzer die ihr home nicht verlassen dürfen? Also diese sollen auch keine leserechte auf irgendwelche dateien außerhalb ihres home haben.

Ich würde auch gern die rechte verwaltung zentral bündeln. Login, samba, nfs, web,... überall gibts entweder ne ganze oder halbe extra verwaltung von nutzern. Ich würde das gern irgendwie bündeln, sodas ich mal schnell sagen kann. nutzer A darf samba:/musik nutzen., oder eben was anderes....
Ich denke da irgendwie an LDAP, ich habe das zwar vor längerm mal versucht, aber ich kam damit nicht klar. Schön wäre nen webfrontend dafür. Allerdings weiß ich nicht ob das der richtige weg ist.

Hmm Fragen über Fragen....

Naja bisher beschränkte sich bei mir user verwaltung auf benutzer anlegen/löschen und bei den einzelnen dateien die rechte via kde/mc/chmod zu setzen.

Kann mir hier jemand nen Rat geben wie ich meine user endlich geordnet bekomme?

Danke!
_________________
AMD Sempron 2400+ / 1GB RAM / NVidia Geforce 5200FX /
Kernel 2.6.31-gentoo-r4 / kde 4.3
Back to top
View user's profile Send private message
primat
Guru
Guru


Joined: 12 Jan 2004
Posts: 437
Location: Berlin

PostPosted: Wed Jun 09, 2004 11:39 am    Post subject: Reply with quote

Ich glaube, Du solltest Dir mal Access Control Lists (ACL) anschauen.
Gruss
Back to top
View user's profile Send private message
ruth
Retired Dev
Retired Dev


Joined: 07 Sep 2003
Posts: 640
Location: M / AN / BY / GER

PostPosted: Wed Jun 09, 2004 12:14 pm    Post subject: Reply with quote

hallihallo... ;)

Code:

The umask command changes the default permissions for files and directories created in the current shell session. (Note that in X Windows this will only affect the current window). To change the default permission for all shell sessions put the appropriate umask command in your shell startup file. The Unix shell reads a startup file before it does anything else. The file contains commands that set up your working environment. The appropriate startup file depends on your shell.

Shell    Startup File
Bourne (sh)    .profile
Korn (ksh)    .profile
Bash (bash)    .bash_profile
.profile (if .bash_profile not found)
Z-Shell (zsh)    .zprofile
C-Shell (csh)    .cshrc
TC-Shell (tcsh)    .tcshrc
.cshrc (if .tcshrc not found)


dann noch:
Code:

umask [options] mask
If mask is specified, umask sets the file mode creation mask. The file mode creation mask defines the default file permissions for newly created files and directories. If mask is not specified, umask prints the current file mode creation mask.

Umask is a built-in shell command. In modern versions of the Korn shell and its derivatives, mask can be specified using symbolic format. The mask can be specified using octal format in all Unix shells.

The umask command is usually executed in the shell startup file.

Options:
     -S      Output in symbolic format. This option is not available in all Unix shells.

Specifying Mode in Octal Format:

nnn

Sets the permissions based on three octal numbers. The first number defines access for the user, the second for the group and the last for others. The octal number, n, is a number between 0 and 7. Each type of permission has an octal number associated with it.
Permissions    Octal Number
Execute    1
Write    2
Read    4

The default permission mask is set by adding the octal numbers of file permission denied to each type of user. This provides seven unique numbers for every possible combination of read, write and execute permission. If a 0 is used then all access is granted.

Specifying Mask in Symbolic Format:

who op permission

who can be any combination of
u      (user)
g      (group)
o      (other)
a      (all) (i.e. ugo)

op sets, adds or removes permissions. It is specified as
=      (set permission exactly), or
+      (add permission), or
-      (remove permission)

permission can be any combination of
r      (read)
w      (write)
x      (execute)

Unlike octal format specifications, symbolic format specifications define the default permissions granted to the user, group and others. It is important to grant execute permission to the user; otherwise, you will not be able to cd into new directories. It will not make all newly created files executable.

Examples:

   1.

$ umask 027

      For newly created files and directories, the user has read, write and execute permission, the group has read and execute permission (denied write permission = 2), others have no permissions (denied execute, write and read permission = 1 + 2 + 4 = 7).

   2.

$ umask u=rwx,g=r,o=

      For shells that allow symbolic format, this example is identical to the previous.

   3.

$ umask
027

      Display the current permission mask.

   4.

$ umask -S
u=rwx,g=rx,o=

      If the shell supports it, display the permissions using symbolic format.


das ganze hab ich mal irgendwo gefunden...
hoffe, es hilft dir weiter...
bzgl ssh:

da gibt es z.b.
Code:

AllowGroups
AllowUsers

direktiven, die man in
/etc/ssh/sshd_config
einfügen kann - das führt dann zu dem vo dir gewünschten effekt...

schliesslich:
ja, LDAP ist toll dafür geeignet...
ich nehm'
http://phpldapadmin.sourceforge.net/

das ist wirklich schön...
und damit komm sogar ich kleiner idi** klar.. *grins*

gruss
rootshell
_________________
"The compiler has tried twice to abort and cannot do so; therefore, compilation will now terminate."
-- IBM PL/I (F) error manual


Last edited by ruth on Wed Jun 09, 2004 12:19 pm; edited 2 times in total
Back to top
View user's profile Send private message
slick
Bodhisattva
Bodhisattva


Joined: 20 Apr 2003
Posts: 3495

PostPosted: Wed Jun 09, 2004 12:16 pm    Post subject: Reply with quote

Quote:
Ein weiteres Rechte Problem betrifft ssh. Ich würde gerne nur bestimmte benutzer erlauben sich einzuloggen, bzw. das einige benutzer sich nicht per ssh einloggen können.


Du legst eine 'SSH-Zugriffsgruppe' an wo Du alle User reinpackst die sich per SSH anmelden dürfen. Diese Gruppe stellst Du dann mit AllowGroups in der sshd_config ein.

siehe: http://www.openbsd.org/cgi-bin/man.cgi?query=sshd_config&sektion=5&arch=&apropos=0&manpath=OpenBSD+Current
Back to top
View user's profile Send private message
sarahb523
Guru
Guru


Joined: 10 Mar 2004
Posts: 423
Location: Berlin

PostPosted: Wed Jun 09, 2004 1:10 pm    Post subject: Reply with quote

@rootshell
das mit den beiden files muß ich mir mal genauer ansehen, sieht aber interessant aus.

phpldapadmin is ja richtig supi. außerdem paßt es so super zu phpmyadmin und dem php postgresql admin tool ;-)

@primat
ACL is das das system was in win2k genutzt wird?
Wenn ja dann könnte das genau das sein was ich suche. Denn so einfach wie man in win2k rechte vergeben kann hätte ich das in linux auch gern. Im prinzip suche ich object bezogene rechteverwaltung. Also ich möchte nicht sagen das ein user bestimmte rechte hat, sondern ein objekt soll eine eigenschaft tragen von wem es gelesen/bearbeitet/... werden kann. Dabei sollte es immer möglich sein user hinzuzufügen egal welche gruppe sie sind.
_________________
AMD Sempron 2400+ / 1GB RAM / NVidia Geforce 5200FX /
Kernel 2.6.31-gentoo-r4 / kde 4.3
Back to top
View user's profile Send private message
ruth
Retired Dev
Retired Dev


Joined: 07 Sep 2003
Posts: 640
Location: M / AN / BY / GER

PostPosted: Wed Jun 09, 2004 1:28 pm    Post subject: Reply with quote

hi nochmal,

du hattest auch gefragt, wie du user anlegen kannst, die ihr /home
nicht verlassen dürfen...
also je nachdem geht man hier bis zu einem chroot-login:
Code:

/*
 * chrlogin.c  -- chroot login
 * acts as login shell in /etc/passwd for a user who has to completely
 * live in a chroot environment
 *
 * Harald Weidner <hweidner@gmx.net>
 * First release: 1999-06-30
 * Last update: 2002-09-01
 *
 * Installation:
 * compile:  gcc -Wall -O2 -s chrlogin.c -o chrlogin
 * install:  cp to /usr/local/sbin, chown root, chmod 4755
 * create chroot directory (here: /home/chroot)
 * create base file system under /home/chroot
 * DISABLE all setuid root binaries under /home/chroot !!!
 *
 * Install a user:
 * create a user using 'adduser'; set password with 'passwd'
 * set /usr/local/sbin/chrlogin als login shell for that user in /etc/passwd
 * create a user in the chroot-Environment
 * (e.g. by filling out /home/chroot/etc/passwd and creating
 * /home/chroot/home/<username> by hand; that user should have the same
 * uid and gid as in /etc/passwd; login shell must be /bin/bash)
 *
 * This code is released under the terms of the GNU General Public
 * License (GPL). THERE IS NO WARRANTY! USE AT YOUR OWN RISK!
 * See http://www.fsf.org/licenses/gpl.html for the full text of the GPL.
 */


/* ----- Configuration parameters ---------------------------------------- */

/* shell for chroot'ed users */

#define SHELL "/bin/bash"

/* chroot directory level
 * This parameter defines, how many subdirs, beginning from the
 * root directory /, are treated as the root of the chroot environment.
 * Example:
 * with CHROOT_LEVEL of 2, /home/chroot/home/joe means:
 *                         0    1      2    3
 * /home/chroot is the chroot base directory,
 * /home/joe is the home directory within the chroot environment
 */
#define CHROOT_LEVEL 2

/* ----- End of configuration parameters --------------------------------- */



#include <stdio.h>
#include <unistd.h>
#include <stdlib.h>
#include <errno.h>
#include <string.h>
#include <pwd.h>
#include <sys/types.h>
#include <sys/stat.h>

#define MAX_STRING 1024


int main(int argc, char *argv[], char *envp[])
{
  int real_user = getuid();
  struct passwd *pw_ent = NULL;
  struct stat stat_buf;
  char *p;
  int cnt;
  char home_dir[MAX_STRING], shell[MAX_STRING], chroot_dir[MAX_STRING];


  /* sanity checks */

  if(geteuid() != 0) {
    fprintf(stderr, "%s: This program needs to be setuid root.\n",
       argv[0]);
    exit(-1);
  }

  if(real_user == 0) {
    fprintf(stderr, "%s: The target user must not be root.\n",
       argv[0]);
    exit(-1);
  }


  /* look up user in system's /etc/passwd */

  if((pw_ent = getpwuid(real_user)) == NULL) {
    fprintf(stderr, "%s: User #%d does not exit in /etc/passwd.\n",
       argv[0], real_user);
    exit(-1);
  }


  /* check home directory */

  strncpy(chroot_dir, pw_ent->pw_dir, MAX_STRING - 1);
  chroot_dir[MAX_STRING] = 0;

  if(chroot_dir[0] != '/') {
    fprintf(stderr, "%s: Home directory %s does not begin with '/'.\n",
       argv[0], chroot_dir);
  }

  if(stat(chroot_dir, &stat_buf) != 0) {
    fprintf(stderr, "%s: Home directory %s does not exist:\n%s\n",
       argv[0], chroot_dir, strerror(errno));
  }


  /* extract chroot directory */

  for(p = chroot_dir, cnt = -1 ; *p; p++) {
    if(*p == '/')
      cnt++;
    if(cnt == CHROOT_LEVEL) {
      *p = 0;
      break;
    }
  }

  if(cnt < CHROOT_LEVEL) {
    fprintf(stderr, "%s: Home directory %s is too short to reach "
       "chroot shell level %d.\n",
       argv[0], chroot_dir, CHROOT_LEVEL);
    exit(-1);
  }


  /* check existance of SHELL */

  strncpy(shell, chroot_dir, MAX_STRING);
  strncat(shell, SHELL, MAX_STRING - strlen(shell));

  if(stat(shell, &stat_buf) != 0) {
    fprintf(stderr, "%s: Could not access login shell %s:\n%s\n",
       argv[0], shell, strerror(errno));
    exit(-1);
  }
  if(!S_ISREG(stat_buf.st_mode)) {
    fprintf(stderr, "%s: Login shell %s must be a regular file.\n",
       argv[0], shell);
    exit(-1);
  }


  /* enter chroot environment */

  if(chdir(chroot_dir) != 0) {
    fprintf(stderr,
       "%s: Could not chdir() to new root directory %s:\n%s\n",
       argv[0], chroot_dir, strerror(errno));
    exit(-1);
  }
  if(chroot(chroot_dir) != 0) {
    fprintf(stderr,
       "%s: Could not chroot() to new root directory %s:\n%s\n",
       argv[0], chroot_dir, strerror(errno));
    exit(-1);
  }
  setuid(real_user);


  /* look up user in chroot's /etc/passwd */

  if((pw_ent = getpwuid(real_user)) == NULL) {
    fprintf(stderr, "%s: Could not find user #%d in chroot's /etc/passwd.\n",
       argv[0], real_user);
    exit(-1);
  }


  /* change to users home directory */

  if(chdir(pw_ent->pw_dir) != 0) {
    fprintf(stderr,
       "%s: Could not chdir to new home directory %s for user #%d:\n%s\n",
       argv[0], pw_ent->pw_dir, real_user, strerror(errno));
    exit(-1);
  }


  /* adapt command name */
  argv[0] = pw_ent->pw_shell;


  /* adapt HOME environment variable */
  strcpy(home_dir, "HOME=");
  strncat(home_dir, pw_ent->pw_dir, MAX_STRING - strlen(home_dir));
  putenv(home_dir);

  /* execute shell */
  execve(SHELL, argv, envp);

  return 0;
}


empfehl ich dir dafür...
musst halt dann ein extra environment per user bauen... ;)

hoffe, es hilft dir...

gruss
rootshell
_________________
"The compiler has tried twice to abort and cannot do so; therefore, compilation will now terminate."
-- IBM PL/I (F) error manual
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Deutsches Forum (German) All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum