You are not logged in.

#1 2009-10-03 16:59:04

gudgip
Member
Registered: 2009-02-06
Posts: 11

How to modify the terminal login?

Hi,

I'm searching a way to modify the terminal-based login. I'd like to change the way it says "wrong password" (I'd like it to say something using festival). I haven't found a way, anyone who can help me?

Thanks in advance,
gudgip

Offline

#2 2009-10-03 23:51:56

Lexion
Member
Registered: 2008-03-23
Posts: 510

Re: How to modify the terminal login?

the login is handled by agetty and the "wrong password" message is probably compiled into it's source code, so you may have to patch it.  I'm not 100% on this, but I'm about 75% sure.


urxvtc / wmii / zsh / configs / onebluecat.net
Arch will not hold your hand

Offline

#3 2009-10-04 00:02:26

Ranguvar
Member
Registered: 2008-08-12
Posts: 2,563

Re: How to modify the terminal login?

Look in util-linux-2.16/login-utils/simpleinit.c, line 345 or thereabouts wink
Just replace the puts line with whatever you like.

Offline

#4 2009-10-04 09:01:30

gudgip
Member
Registered: 2009-02-06
Posts: 11

Re: How to modify the terminal login?

Ranguvar wrote:

Look in util-linux-2.16/login-utils/simpleinit.c, line 345 or thereabouts wink
Just replace the puts line with whatever you like.

[gudgip@gudhost ~]$ locate util-linux-2.16
[gudgip@gudhost ~]$ locate login-utils
[gudgip@gudhost ~]$ pacman -Ss login-utils
[gudgip@gudhost ~]$

Looks like your system is a little different than mine tongue

Offline

#5 2009-10-04 09:23:37

lolilolicon
Member
Registered: 2009-03-05
Posts: 1,722

Re: How to modify the terminal login?

You need to download ftp://ftp.kernel.org/pub/linux/utils/ut … 16.tar.bz2
extract it and edit util-linux-ng-2.16/login-utils/simpleinit.c at line... yeah, 345 wink

Last edited by lolilolicon (2009-10-04 09:24:19)


This silver ladybug at line 28...

Offline

#6 2009-10-04 10:01:34

gudgip
Member
Registered: 2009-02-06
Posts: 11

Re: How to modify the terminal login?

First of all, thanks for the help guys!

So I downloaded the package:

cd ~/Downloads/
cd util-linux-ng-2.16
vim'ing the file, editting what I need
sudo ./configure
make
make install

Now I try to reboot and I see that it says "login incorrect", not even "wrong password" -> like it should be in that package (line 345)

What did I do wrong? smile

    if ( !strcmp (crypt (pass, rootpass), rootpass) ) return 1;

    system('echo "Wrong password, please try again." | festival --tts');
    puts (_("\nWrong password.\n"));
    }

I only added the system() line.

Last edited by gudgip (2009-10-04 10:04:26)

Offline

#7 2009-10-04 13:25:15

Ranguvar
Member
Registered: 2008-08-12
Posts: 2,563

Re: How to modify the terminal login?

Aside from any bad source editing (you'll have to ask someone more experienced with C):

NEVER use 'make', 'make install'!!  x.x  If you still have that source dir, do a 'make uninstall' pronto.
Use ABS for installing stuff, especially stuff Arch already has in the repos: http://wiki.archlinux.org/index.php/ABS … ild_System
With 'make install', the files it dumps all over your system are not tracked by Pacman, and thus cannot easily be installed, uninstalled, upgraded, etc.  Plus, the Arch util-linux-ng package may do special things a simple 'make install' does not.

Offline

#8 2009-10-04 15:08:55

gudgip
Member
Registered: 2009-02-06
Posts: 11

Re: How to modify the terminal login?

Ranguvar wrote:

Aside from any bad source editing (you'll have to ask someone more experienced with C):

NEVER use 'make', 'make install'!!  x.x  If you still have that source dir, do a 'make uninstall' pronto.
Use ABS for installing stuff, especially stuff Arch already has in the repos: http://wiki.archlinux.org/index.php/ABS … ild_System
With 'make install', the files it dumps all over your system are not tracked by Pacman, and thus cannot easily be installed, uninstalled, upgraded, etc.  Plus, the Arch util-linux-ng package may do special things a simple 'make install' does not.

Bad source editting? I just added 1 line, that's it..
And I'll read up about ABS, thanks.

Offline

#9 2009-10-04 15:59:43

deltaecho
Member
From: Georgia (USA)
Registered: 2008-08-06
Posts: 193

Re: How to modify the terminal login?

I'm not much of a C programmer, I deal mostly with Java / PHP / JavaScript / and other web-oriented languages, but I would suggest modifying your system() function call to the following:

system("echo \"Wrong password, please try again.\" | festival --tts");

All the C-based languages I've dealt with (C, C++, Java, etc.) use the single quote (') to encapsulate a single character, not a string (an array of characters).  Changing the outer single quotes to double quotes and escaping the inner double quotes should help you a lot.  If you prefer, since you don't need to perform any string interpolations (such as substituting $shell with bash) from your system call, you can replace the inner double quotes with single quotes, but make sure you still replace the outer single quotes with double quotes:

system("echo 'Wrong password, please try again.' | festival --tts");

In agreement with @Ranguvar, I would definitely suggest learning about the ABS.

EDIT: Also, I would suggest against running sudo ./configure, for security purposes.  Simply running ./configure should suffice.

Last edited by deltaecho (2009-10-04 16:03:26)


Dylon

Offline

#10 2009-10-04 16:32:55

gudgip
Member
Registered: 2009-02-06
Posts: 11

Re: How to modify the terminal login?

So I did 'make uninstall' and suddenly I couldn't boot anymore, so I booted a livecd of archlinux and chrooted into /dev/sda3 and ./configure 'd the util-linux again. I've used slackware/ubuntu before, that's maybe the reason that I ./configure some stuff. Is there a way to convert the way I've done for linux-utils to the ABS-way, or should I just leave it as it is now? smile

I use sudo because ./configure gives permission denied wink

Last edited by gudgip (2009-10-04 16:35:42)

Offline

#11 2009-10-04 16:40:15

deltaecho
Member
From: Georgia (USA)
Registered: 2008-08-06
Posts: 193

Re: How to modify the terminal login?

gudgip wrote:

So I did 'make uninstall' and suddenly I couldn't boot anymore

Thus the reason you should use the ABS and Pacman smile

Assuming the only files that have been changed were those directly related to util-linux-ng, all you should have to do to fix your system is reinstall util-linux-ng from the chroot:

# pacman -Sy util-linux-ng

EDIT: If ./configure gives you permission denied, I would imagine you unpacked the archive with your root account -- compiling applications as root is a bad idea.

Last edited by deltaecho (2009-10-04 16:41:45)


Dylon

Offline

#12 2009-10-04 16:48:30

gudgip
Member
Registered: 2009-02-06
Posts: 11

Re: How to modify the terminal login?

Thanks, I'm installing abs as we speak. I've quickly looked into ABS and it should indeed make things easier. Thanks all for the great help!
I'm going to continue my quest to editting the login tongue

Offline

#13 2009-10-04 16:58:34

deltaecho
Member
From: Georgia (USA)
Registered: 2008-08-06
Posts: 193

Re: How to modify the terminal login?

Cool then!

A quick grep -rni 'login incorrect' . in the util-linux-ng source revealed lines 640, 658, and 863 of the util-linux-ng-2.16/login-utils/login.c file each print "Login incorrect" to the console window; those are probably the lines you want to change.

Last edited by deltaecho (2009-10-04 16:59:08)


Dylon

Offline

#14 2009-10-04 17:00:21

pyther
Member
Registered: 2008-01-21
Posts: 1,395
Website

Re: How to modify the terminal login?

Also at the login screen I don't think PATH is set, thus you should use the full path for festival


Website - Blog - arch-home
Arch User since March 2005

Offline

#15 2009-10-04 17:23:46

gudgip
Member
Registered: 2009-02-06
Posts: 11

Re: How to modify the terminal login?

Thanks for those amazingly usefull hints! I've just tried to install a package from source using abs and it worked smile

Offline

#16 2009-10-06 00:24:08

Ranguvar
Member
Registered: 2008-08-12
Posts: 2,563

Re: How to modify the terminal login?

ABS is black magic big_smile
And well-spotted, pyther (dunno if true).

Offline

Board footer

Powered by FluxBB