Dsy Network www | forum | my | didattica | howto | wiki | el goog | stats | blog | dona | rappresentanti
Homepage
 Register   Calendar   Members  Faq   Search  Logout 
.dsy:it. : Powered by vBulletin version 2.3.1 .dsy:it. > Didattica > Corsi N - Z > Sistemi operativi I > Gestione degli utenti
  Last Thread   Next Thread
Author
Thread    Expand all | Contract all    Post New Thread    Post A Reply
Collapse
Laüra
.simpatizzante.

User info:
Registered: Dec 2004
Posts: 14 (0.00 al dì)
Location:
Corso: Informatica
Anno: 3
Time Online: 13:03:02: [...]
Status: Offline

Post actions:

Edit | Report | IP: Logged
Gestione degli utenti

Ciao a tutti!

Ho delle difficoltà per quanto riguarda la gestione degli utenti in Minix. Mi sembra che non sia stata spiegata a lezione di lab.....o magari ero io distratta.....
Qualcuno potrebbe spiegarmi quello che dovrei sapere per l'esame di lab riguardo agli utenti e quali comandi bisogna saper usare?

Se devo creare un nuovo utente....posso creare un nuovo gruppo in cui metterlo o devo usare quelli già esistenti?
Come si crea un nuovo gruppo?

Come si fa a cancellare un utente?

Grazie!

18-07-2007 16:35
Click Here to See the Profile for Laüra Click here to Send Laüra a Private Message Find more posts by Laüra Add Laüra to your buddy list Printer Friendly version Email this Article to a friend Reply w/Quote
Collapse
n3o
tanto c'è SPASS...

User info:
Registered: Oct 2005
Posts: 134 (0.02 al dì)
Location: Brescia
Corso: Informatica Magistrale
Anno:
Time Online: 1 Day, 19:26:05: [...]
Status: Offline

Post actions:

Edit | Report | IP: Logged

Per creare un utente prova a leggerti i manuali di adduser, passwd, chsh, chfn

Per creare o eliminare un gruppo dai un occhio al file /etc/group

Per cancellare un utente elimina la sua home directory rm -r /home/utente; elimina le righe contenenti il nome utente da /etc/passwd e /etc/shadow

__________________
The answer is blowing in the wind...

Last edited by n3o on 19-07-2007 at 11:12

18-07-2007 17:30
Click Here to See the Profile for n3o Click here to Send n3o a Private Message Find more posts by n3o Add n3o to your buddy list Printer Friendly version Email this Article to a friend Reply w/Quote
Collapse
n3o
tanto c'è SPASS...

User info:
Registered: Oct 2005
Posts: 134 (0.02 al dì)
Location: Brescia
Corso: Informatica Magistrale
Anno:
Time Online: 1 Day, 19:26:05: [...]
Status: Offline

Post actions:

Edit | Report | IP: Logged

Posto una soluzione più umana di quella del prof per aggiungere degli utenti da una lista contenuta in un file:

Contenuto del file (user group home-dir):

code:
pippo operator /home/pippo pluto others /home/pluto
Script:
code:
1) #!/bin/bash 2) NUM=$(cat $1 | wc -l) 3) COUNT=0 4) while [ $NUM -ne $COUNT ]; do 5) COUNT=$(expr $COUNT + 1) 6) adduser $(cat $1 | awk "NR == $COUNT") 7) done

Spiegazione:
  1. Interprete script
  2. in NUM ci sarà il numero di utenti (cat $1 | wc -l) presenti nel file passato come parametro ($1)
  3. Contatore dell'utente corrente
  4. Finchè il contatore non raggiunge il numero degli utenti nel file...
  5. Aumento il contatore
  6. La sintassi di adduser è: adduser user group home-dir, ovvero proprio la formattazione che abbiamo nel nostro file, quindi leggo il file (cat) e con awk estraggo la $COUNT riga (awk "NR == $COUNT"). è un parametro da prendere "as is" ovvero così com'è, per maggiori informazioni guardate il man awk
  7. fine ciclo

__________________
The answer is blowing in the wind...

19-07-2007 11:07
Click Here to See the Profile for n3o Click here to Send n3o a Private Message Find more posts by n3o Add n3o to your buddy list Printer Friendly version Email this Article to a friend Reply w/Quote
Collapse
n3o
tanto c'è SPASS...

User info:
Registered: Oct 2005
Posts: 134 (0.02 al dì)
Location: Brescia
Corso: Informatica Magistrale
Anno:
Time Online: 1 Day, 19:26:05: [...]
Status: Offline

Post actions:

Edit | Report | IP: Logged

Per completezza di informazione la riga (6)

6) adduser $(cat $1 | awk "NR == $COUNT")

può essere sostituita anche con:

6) adduser $(cat $1 | xargs -n 3)

in questo modo xargs prende il risultato di cat non un "campo" alla volta (ovvero una stringa separata da blank), ma 3 alla volta, ricostruendo così una intera riga del file pronta da passare ad adduser
Dopo xargs non c'è nulla, quindi per default viene preso echo (xargs == xargs echo)

A voi la scelta !!!

__________________
The answer is blowing in the wind...

19-07-2007 14:26
Click Here to See the Profile for n3o Click here to Send n3o a Private Message Find more posts by n3o Add n3o to your buddy list Printer Friendly version Email this Article to a friend Reply w/Quote
Collapse
Simaldeff
.fedelissimo.

User info:
Registered: Jun 2004
Posts: 41 (0.01 al dì)
Location: Monza
Corso: Informatica
Anno: terzo
Time Online: 7:20:14 [...]
Status: Offline

Post actions:

Edit | Report | IP: Logged

vorrei far notare che la semplice linea di comando

cat user.list | xargs -n 3 adduser

basta e avanza se il file user.list e' del formato seguente :
<user_name> <group> <home_dir>

come nell'esempio.
Ma il prof ha spiegato come si puo fare a riordinare una stringa (se per esempio nel file viene scritto con ordine diverso nome, homedir e gruppo)?

__________________
There is no way to happyness, happyness is the way. -Buddha-

19-07-2007 17:14
Click Here to See the Profile for Simaldeff Click here to Send Simaldeff a Private Message Visit Simaldeff's homepage! Find more posts by Simaldeff Add Simaldeff to your buddy list Printer Friendly version Email this Article to a friend Reply w/Quote
Collapse
n3o
tanto c'è SPASS...

User info:
Registered: Oct 2005
Posts: 134 (0.02 al dì)
Location: Brescia
Corso: Informatica Magistrale
Anno:
Time Online: 1 Day, 19:26:05: [...]
Status: Offline

Post actions:

Edit | Report | IP: Logged

Grazie di avercelo fatto notare! :D (ma l'esercizio l'ho studiato apposta per metterci un while e giocare con xargs e awk che potrebbero esserci all'esame!)

Credo l'unico modo per riordinare sia leggere pezzo per pezzo i campi con un for, metterli in variabili e poi fare un adduser passandogliele (controllando di farlo ogni 3 cicli...)
Se è una questione di separatori tr basta e avanza

__________________
The answer is blowing in the wind...

Last edited by n3o on 19-07-2007 at 17:47

19-07-2007 17:33
Click Here to See the Profile for n3o Click here to Send n3o a Private Message Find more posts by n3o Add n3o to your buddy list Printer Friendly version Email this Article to a friend Reply w/Quote
Collapse
mjfan80
.consigliere.

User info:
Registered: Nov 2001
Posts: 140 (0.02 al dì)
Location: Vallecamonica (BRESCIA)
Corso: Informatica quinquennale
Anno: 5°? 6°? 7°? bho
Time Online: 19:22:16 [...]
Status: Offline

Post actions:

Edit | Report | IP: Logged

Originally posted by n3o
Posto una soluzione più umana di quella del prof per aggiungere degli utenti da una lista contenuta in un file:

Contenuto del file (user group home-dir):
code:
pippo operator /home/pippo pluto others /home/pluto
Script:
code:
1) #!/bin/bash 2) NUM=$(cat $1 | wc -l) 3) COUNT=0 4) while [ $NUM -ne $COUNT ]; do 5) COUNT=$(expr $COUNT + 1) 6) adduser $(cat $1 | awk "NR == $COUNT") 7) done

Spiegazione:
  1. Interprete script
  2. in NUM ci sarà il numero di utenti (cat $1 | wc -l) presenti nel file passato come parametro ($1)
  3. Contatore dell'utente corrente
  4. Finchè il contatore non raggiunge il numero degli utenti nel file...
  5. Aumento il contatore
  6. La sintassi di adduser è: adduser user group home-dir, ovvero proprio la formattazione che abbiamo nel nostro file, quindi leggo il file (cat) e con awk estraggo la $COUNT riga (awk "NR == $COUNT"). è un parametro da prendere "as is" ovvero così com'è, per maggiori informazioni guardate il man awk
  7. fine ciclo


dovrebbe esserci anche questa soluzione
ho provato, pare funzionare

code:
#!/bin/sh while read linea: do adduser $linea done < utenti.txt

__________________
Heal The World
Just Because You Read It In A Magazine Or You See It On A Tv Scren Don't Make It Factual

29-01-2008 21:53
Click Here to See the Profile for mjfan80 Click here to Send mjfan80 a Private Message Visit mjfan80's homepage! Find more posts by mjfan80 Add mjfan80 to your buddy list Printer Friendly version Email this Article to a friend Reply w/Quote
All times are GMT. The time now is 14:05.    Post New Thread    Post A Reply
  Last Thread   Next Thread
Show Printable Version | Email this Page | Subscribe to this Thread | Add to Bookmarks

Forum Jump:
Rate This Thread:

Forum Rules:
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is OFF
vB code is ON
Smilies are ON
[IMG] code is ON
 

Powered by: vBulletin v2.3.1 - Copyright ©2000 - 2002, Jelsoft Enterprises Limited
Mantained by dsy crew (email) | Collabora con noi | Segnalaci un bug | Archive | Regolamento | Licenze | Thanks | Syndacate
Pagina generata in 0.100 seconds (62.23% PHP - 37.77% MySQL) con 23 query.